0

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?

2 Answers2

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 ~/.smbcredentialsthat 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

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