User avatar
GreenMartian
Posts: 173
Joined: Tue Feb 14, 2017 12:10 pm
Location: Wisconsin, US

NAS (Directly Attached to Router) Setup, Automount & Autodismount

Tue Oct 24, 2017 6:17 am

The following tutorial is for those looking to setup a NAS which is directly attached to their wifi router.

Note 1: If your NAS is alternatively attached to your PC (not to your router), you can automount that at boot very easily by opening that drive using the program Disks (from Menu), selecting that drive and selecting to have the drive mounted at boot. You shouldn't have to follow the manual steps below.

Note 2: Be sure you've upgraded and are running systemd 235, as well as booting the linux-lts kernel. (Another post indicates a possible bug in the linux-current kernel. So just to be sure it works as of the date of this tutorial).

1) Install samba & cifs-utils from the Solus software center

2) Create a local directory for your NAS to mount...

Code: Select all

sudo mkdir -p /media/yournasname/whatyouwantyournasfoldertobenamedhere
3) Set permissions to the folder you just created...

Code: Select all

sudo chmod 777 /media/yournasname/whatyouwantyournasfoldertobenamedhere
4) Set folder ownership (replace user:user with your credentials)...

Code: Select all

sudo chown user:user /media/yournasname/whatyouwantyournasfoldertobenamedhere
5) In terminal, edit your /etc/fstab file...

Code: Select all

sudo gedit /etc/fstab
And add the following line to the end of the file...

Code: Select all

//yourrouterIPaddress/whatyouwantyourfoldertobenamedhere /media/yournasname/whatyouwantyournasfoldertobenamedhere cifs noauto,x-systemd.automount, _netdev,users,uid=1000,gid=1000,rw,guest,vers=1.0 0 0
***Update 1/12/2018: By adding vers=1.0 to the above fstab line, this solves a bug with Samba in newer kernels. Without it, the share didn't automount and threw out a "mount error:host is down".

5b) Some distros with network manager require a delay before loading. In this case, use terminal to...

Code: Select all

sudo systemctl enable NetworkManager-wait-online.service


6) Save the file and exit your text editor.

7) You may (or may not) have to include this extra step...

Manually mount the samba drive via Nautilus (For example: smb://192.168.1.1) At this point, the samba permissions pop-up box offers access as anonymous, or registered user. Select registered user, entered user password, and remember forever. Your NAS drive contents should now be loaded.

8) Set CIFS mount access permissions...

Code: Select all

sudo chmod u+s /sbin/mount.cifs
9) Save & reboot.

You're NAS should be visible and accessible from your file manager.

Return to “Tutorials”