-
Notifications
You must be signed in to change notification settings - Fork 1
Setting up a SMB NAS Mount
- Recommend your NAS account is authenticated with RO privileges on the target NAS SMB share.
- References used in this walkthrough need to be adjusted to suit your environment.
- vi is mentioned as the editor as it is usually available on most systems.
- SMB servername: YourServer or server.ip.address (ie - 192.168.0.5)
- SMB sharename: Music (ie - //YourServer/Music)
- SMB NAS user: mediauser
- SMB NAS password: ******
Make the mount directory:
sudo mkdir /media/MusicLibrary
sudo apt-get install samba-common smbclient samba-common-bin smbclient cifs-utils -y
Test:
sudo mount -t cifs //YourServer/Music /media/MusicLibrary -o user=mediauser,pass=******
Check:
username@randy:~ $ df -h |grep Music
//YourServer/Music 13T 7.8T 4.4T 65% /media/MusicLibrary
If all good:
sudo umount /media/MusicLibrary
Create a credentials file to input for fstab and add two lines:
vi ~/.smbcredentials
username=mediauser password=******
Protect:
chmod 600 ~/.smbcredentials
Edit fstab and add the mount info to the end of the file:
sudo cp /etc/fstab ~/fstab.orig
sudo vi /etc/fstab
# SMB mount for Music library:
//YourServer/Music /media/MusicLibrary cifs _netdev,credentials=/home/randy/.smbcredentials 0 0
Reload the fstab to read-in changes
sudo systemctl daemon-reload
Test:
sudo mount -a
username@randy:~ $ df -h |grep Music
//YourServer/Music 13T 7.8T 4.4T 65% /media/MusicLibrary
If your all good... test that the mount comes back after a reboot:
sudo shutdown -r now
Check that the new mountpoint is loaded automatically
username@randy:~ $ df -h |grep Music
//YourServer/Music 13T 7.8T 4.4T 65% /media/MusicLibrary
Once your done and if your paranoid about security, clear history:
username@randy:~ $ history -c