Mounting network shares on Linux
I have a Synology NAS at home, which acts as a file share that my server writes to. I ran into some problems using the default network share functionality in GNOME's Nautilus, namely unable to delete files or folders. I suspect this is because of the file permissions, as the files are written by a app running inside Docker container (which I guess would be running as root inside the container).
The good news is mounting the network share via
fstab worked seamlessly.
Setting it up
- Create a directory under
/mediafor the mount point of the network share, I called mine
nas, so I did
sudo mkdir /media/nas.
- Create a credentials file in your home folder, I create mine at
~/.smbwhich should contain the following:
# ~/.smb user=<NETWORK_SHARE_USERNAME> password=<NETWORK_SHARE_PASSWORD>
- Add an entry to your fstab file at
# /etc/fstab //<IP_OR_DOMAIN_OF_SHARE>/<SHARE_NAME> /media/nas cifs uid=1000,gid=1000,credentials=/home/<USER>/.smb 0 0
- Apply the changes by running
sudo mount -a
The mount should now appear and you should have access to your files.