DEV Community

pr4th4m
pr4th4m

Posted on

3 1

Setup NFS and SMB server on Raspberry Pi

NFS server

  • Install server
  sudo apt install nfs-common nfs-server
Enter fullscreen mode Exit fullscreen mode
  • Create directory you wanna share
  mkdir /media/storage
Enter fullscreen mode Exit fullscreen mode
  • Edit file /etc/exports with below content
  /media/storage 192.168.1.0/24(rw,all_squash,insecure,no_subtree_check)
  # <directory> <who_can_access> <options>
Enter fullscreen mode Exit fullscreen mode
  • Restart services
  sudo service nfs restart
  /etc/init.d/nfs-kernel-server restart
Enter fullscreen mode Exit fullscreen mode
  • Connecting from client (MacOS)
  mkdir /Users/username/nfs_shared
  sudo mount -v -o "resvport" 192.168.1.9:/media/storage /Users/username/nfs_shared
Enter fullscreen mode Exit fullscreen mode

Samba server

  • Install server
  sudo apt-get install samba samba-common-bin
Enter fullscreen mode Exit fullscreen mode
  • Create samba password for system user
  sudo smbpasswd -a pi
Enter fullscreen mode Exit fullscreen mode
  • Create directory you wanna share
  mkdir /media/storage
Enter fullscreen mode Exit fullscreen mode
  • Edit file /etc/samba/smb.conf with below content
  [PI]
  comment = Pi workspace
  path = /media/storage
  create mask = 0775
  directory mask = 0775
  read only = no
  browseable = yes
  public = no
  force user = pi
  only guest = no
Enter fullscreen mode Exit fullscreen mode
  • Restart service
  sudo service samba restart
Enter fullscreen mode Exit fullscreen mode
  • Connecting from client (MacOS)
  mkdir /Users/username/smb_shared
  mount -t smbfs //pi@192.168.1.9/pi /Users/username/smb_shared
Enter fullscreen mode Exit fullscreen mode
đź‘‹ While you are here

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

đź‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay