Skip to content

Instantly share code, notes, and snippets.

@zekroTJA
Created May 20, 2018 13:46
Show Gist options
  • Save zekroTJA/ecf940846520c99f8e9d1ab2f9541938 to your computer and use it in GitHub Desktop.
Save zekroTJA/ecf940846520c99f8e9d1ab2f9541938 to your computer and use it in GitHub Desktop.

Raspberry Pi NAS

  1. Install NTFS and samba
# apt install ntfs-g3 samba samba-common-bin
  1. Attach NAS drive to RasPi and get device name
$ fdisk -l
> Device     Boot Start      End  Sectors  Size Id Type
> /dev/sda1  *     2048 60061695 60059648 28.7G  c W95 FAT32 (LBA)
  1. Create mount path and mount drive
# mkdir /media/hdd1
# mount -t auto /dev/sda1 /media/hdd1
  1. Cretae copy of samba config and edit config
# cp /etc/samba/smb.conf /etc/samba/smb.conf.save
# nano /etc/samba/smb.conf
  1. Make shared directories writable
#======================= Share Definitions =======================

...

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = no
#              ^
#              Defaultly this is "yes", change it to "no"
  1. Add network drive at the end of the file
[PINAS]
comment = PINAS
path = /media/hdd1/nas
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no
  1. Restart samba
# /etc/init.d/samba restart
  1. Cretae nas user for authentication
# useradd nas -m -G users
# passwd nas
  1. Add user to samba
# smbpasswd -a nas
  1. Add drive to auto mount on reboot
# echo "/dev/sda1 /media/hdd1 auto noatime 0 0" >> /etc/fstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment