I have a valid, reachable SMB share on my Windows box, which I can mount with

sudo mount -t cifs // /mnt/WinC -o username=foo,password=bar

but isn't mountable from my fstab. The fstab entry reads

//    /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


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?


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.

  • That's fixed it, thanks. I'd assumed smbfs was already installed since I was able to mount it manually.
    – Rob Cowell
    Aug 10 '10 at 10:09
  • 1
    Yeah it's crazy. smbfs is actually the deprecated predecessor to cifs so it's even stranger that the smbfs package provides this command.
    – Oli
    Aug 10 '10 at 10:16
  • Nice explanation :)
    – invert
    Aug 11 '10 at 11:04
  • 8
    If you're using ubuntu 13.04, you should install cifs-utils instead of smbfs. May 11 '13 at 8:10
  • 1
    Answered decades ago, I know, but I needed this solution for LTS 12.04 and spent way-too-long searching. Aug 9 '13 at 14:16

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...

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.