Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 19 down vote accepted

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.

share|improve this answer
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
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
If you're using ubuntu 13.04, you should install cifs-utils instead of smbfs. – Klaus Schüssler May 11 '13 at 8:10
Answered decades ago, I know, but I needed this solution for LTS 12.04 and spent way-too-long searching. – bobthechemist 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...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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