Problems mounting an SMB share in my fstab
I have a valid, reachable SMB share on my Windows box, which I can mount with
sudo mount -t cifs //192.168.0.9/C /mnt/WinC -o username=foo,password=bar
but isn't mountable from my fstab. The fstab entry reads
//192.168.0.9 /mnt/WinC credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
and the credentials file (which has 777 permissions while I get this working) contains
username=foo
password=bar
but sudo mount -a results in an error, which from a dmesg | tail, shows
[225040.991705] CIFS VFS: No username specified
[225050.991721] CIFS VFS: cifs_mount failed w/return code = -22
Anyone else seen this issue and managed to resolve it?
Solution 1:
Install smbfs
.
Sounds silly that a package could fix this but when you use credentials files, the kernel diverts to the mount.cifs
command rather than doing the mount itself. This package provides mount.cifs
so should get you on the road to victory!
Edit: As Klaus points out in the comments, for 13.04 and later, you need cifs-utils
.
Solution 2:
I went mad on 14.04. the credential= option was not mounting the share in fstab although I could mount it "by hand" in the cli. Issue was that the "cifs-utils" package was not installed...
sudo apt-get install cifs-utils
and everything was fine...