I want to mount a Windows share using CIFS on my Ubuntu 17.04 machine. I want to use an SMB credentials file for the authentication details, but always get "mount error(13): Permission denied" if I try to use a credentials file. If I embed the username/password in the mount command line I have no problems.
For example, this command fails with "mount error(13): Permission denied":
sudo mount -t cifs //servername/sharename /home/myuser/mediafolder -o credentials=/home/myuser/.smbcredentials,dir_mode=0777,file_mode=0777
But this command works fine, and mounts the share correctly:
sudo mount -t cifs //servername/sharename /home/myuser/mediafolder -o user="My User",pass=MyPassword,dir_mode=0777,file_mode=0777
My .smbcredentials file looks like this:
username='My User' password=MyPassword workgroup=WORKGROUP
After creating the .smbcredentials file I did this:
sudo chown root .smbcredentials sudo chmod 600 .smbcredentials
Finally, I should add that I've been executing all of these commands in a VNC session from a Windows VNC client (I don't know if that's relevant).
Any idea what's wrong with my .smbcredentials file?