I would like to mount a NAS automatically during start up, and have inserted the following line in /etc/fstab:

mount -t cifs -o username=xxxxxx,password=xxxxxx //nas8d5ec9.local/public/ /mnt/qnap_backup

The script does not mount the NAS. However, when I just cut and paste the mount code into a terminal it works as intended.

What do I need to add and/or change?

  • /etc/fstab is not a script - it's a configuration file with a very specific format – steeldriver May 5 '17 at 12:04

The format for mounting cifs shares via /etc/fstab is:

//servername/sharename  /media/windowsshare  cifs  username=msusername,password=mspassword,iocharset=utf8,sec=ntlm  0  0

There is a article about mounting cifs in linux on wiki.ubuntu.com: https://wiki.ubuntu.com/MountWindowsSharesPermanently

  • Thanks! I have added //nas8d5ec9.local/public/ /mnt/qnap_backup cifs guest,iocharset=utf8,sec=ntlm 0 0 to the fstab file. Then, sudo mount -av gives mount error(13): Permission denied. – Henk May 5 '17 at 12:35
  • Maybe sec=ntlmv2 will help ? – Soren A May 5 '17 at 13:03
  • No, that didn't work. Same message. – Henk May 5 '17 at 13:21
  • Have you tried with username= and password= parameters, as you used in your manual mount. Maybe guest doesn't work. – Soren A May 5 '17 at 18:28
  • Yes, I have tried that. No success. – Henk May 6 '17 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.