How can I mount the network hdd everytime I reboot or start up my computer. It works just fine if I execute it everytime in the terminal but it's a bit tedious. Surely there's a way to automate this?
Asked
Active
Viewed 5,110 times
0
-
How to mount a Samba share at boot time? – steeldriver Jul 24 '18 at 11:14
2 Answers
1
You can auto mount a network share by creating an entry in the fstab.
1) Make sure you have cifs-utils:
sudo apt-get install cifs-utils
2) Edit /etc/fstab (with root privileges) sudo vi /etc/fstab
3) Add: //servername/sharename /pathto/mountpoint cifs username=msusername,password=mspassword,iocharset=utf8,sec=ntlm 0 0
4) Save /etc/fstab
note: for extra security use: credentials=[credentialfile],user=[myusername]
in your fstab entry and create a credential file ~/.smbcredentials
that contains this text:
username=[myusername]
password=[mypassword]
Secure the file by using:
chmod 0600 ~/.smbcredentials
note Dont forget to restart samba or your machine to mount the share:
/etc/init.d/samba restart

W.creator
- 49
-
Apparently I need sudo privileges to mount that in /home/me/pc1pool – Grumpy ol' Bear Jul 24 '18 at 11:51
0
//servername/sharename /mnt/mountname cifs username=username,password=password,noperm,defaults,uid=1000,noauto,x-systemd.automount,x-systemd.mount-timeout=10 0 0
This would be better.
Then
sudo systemctl daemon-reload
sudo systemctl restart remote-fs.target

Chenye Zhou
- 21