Ubuntu 18.04 LTS : Mount CIFS On Boot

I am new to Ubuntu and just only started using it. So please be specific if you are able to help me with my issue.

I am trying to automount my Netgear ReadyNAS shared drive which is using SMB1. I am aware of the security risk but there is nothing I can do as that is the only supported version.

Anyway, I am able to mount the shared drive using the following command:

sudo mount -t cifs -o username=MyUsername -o password=MyPassword -o vers=1.0 //192.168.0.34/Family_Medias /mnt/NAS-Media/

However, when I reboot the machine, the mounted folder is no longer mounted. My question is based on the above mount command, how do I add into /etc/fstab?

Please note that I had to add the option vers=1.0 or I will get the error "Host is down" due to the fact that my NAS device only supports SMB1. Thanks for any help you can provide me.


Solution 1:

I use lines in fstab like this

//[my-ip-address]/[my-share] /media/[mount-point] cifs vers=3.0,credentials=[my-login-file],iocharset=utf8,file_mode=0777,dir_mode=0777,uid=[username],gid=[username],nofail 0 0

Once you've edited fstab (make a backup first!) don't reboot yet. Test your work by doing sudo mount -a and fix any errors before you reboot. This prevents breaking your system by an fstab error.

Solution 2:

//192.168.0.34/Family_Medias /mnt/NAS-Media/    cifs credentials=/etc/samba/passwd_file,vers=1.0,sec=ntlm 0 0

can be added to your /etc/fstab file

You then create a /etc/samba/passwd_file or whatever you wish to call it with your credentials

username=secret1
password=secret2

the sec= option may not be needed, I found I needed it on some boxes