3

I have this in my /etc/fstab

//192.168.1.1/S_Drive /mnt/readyshare cifs sec=ntlmv2,username=XXXX,password=XXXXX,uid=1000,gid=1000,iocharset=utf8 0 0

everytime I reboot the pi2, it says

[FAILED] failed to mount /mnt/readyshare

Here is the log

systemctl status mnt-readyshare.mount
mnt-readyshare.mount - /mnt/readyshare
Loaded: loaded (/etc/fstab)
Active: active (mounted) (Result: exit-code) since Tue 2015-04-28 22:42:26 CDT; 5min ago
Where: /mnt/readyshare
What: //192.168.1.1/S_Drive
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Process: 221 ExecMount=/bin/mount -n //192.168.1.1/S_Drive /mnt/readyshare -t cifs -o sec=ntlmv2,username=XXXX,password=XXXXX,uid=1000,gid=1000,iocharset=utf8 (code=exited, status=32)

If i run this command manually, I can mount the drive but I want to auto mount it on startup

sudo mount -t cifs -o sec=ntlm,username=XXXXXX,password=XXXXXXX//192.168.1.1/S_Drive /mnt/readyshare

Any idea why?

1
  • If you're using systemd, please provide proper logging output for the unit. Also, that unit says "Active: active (mounted)" - have you checked if that's true?
    – Izzy
    Apr 29, 2015 at 9:50

1 Answer 1

4

Here's how I did it yesterday on Raspbian:

  1. Create a directory /etc/samba/credentials
  2. Create a file /etc/samba/credentials/myserver
  3. In the myserver file, put the credentials for that server:
username=myusername
password=mypassword

Note: spaces are important here – don’t use " = ", use "=".

# chown -R root.root /etc/samba/credentials
# chmod 700 /etc/samba/credentials
# chmod 600 /etc/samba/credentials/myserver

Once this is done, you can add lines for each mount of that server to your /etc/fstab:

//myserver/music        /music  cifs   credentials=/etc/samba/credentials/myserver 0 0
//myserver/shared       /shared cifs   credentials=/etc/samba/credentials/myserver 0 0

Note that the file in /etc/samba/credentials doesn't have to be named the same thing as the server name – it just makes it easier. I created mount points for /music and /shared before I did this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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