Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 want to be able to mount our file server's file share (on a Mac OS X server, shared via AFP and Windows File Sharing) on my Ubuntu 10.10 linux laptop. I want to be able to mount it as my normal user, and be prompted for the password each time. What do I add to /etc/fstab to make this happen? I know I did it before, but I forgot how now.

EDIT: The share in question is called "G4 320", and I am trying the following line in fstab:

//server_ip/G4\040320    /media/G4/    cifs    user,username=something    0    0

But I'm getting the following via dmesg:

CIFS VFS: cifs_mount failed w/return code = -6


As requested, more debug info. Output of dmesg with my fstab line:

[151994.740138] CIFS VFS: cifs_mount failed w/return code = -6
[152007.760136] CIFS VFS: cifs_mount failed w/return code = -6
[152132.770147] CIFS VFS: cifs_mount failed w/return code = -6
[152221.700152] CIFS VFS: cifs_mount failed w/return code = -6
[152245.340132] CIFS VFS: cifs_mount failed w/return code = -6

Output of dmesg with the credentials line from Michael:

[153117.088656] CIFS VFS: No username specified
[153117.088668] CIFS VFS: cifs_mount failed w/return code = -22
[153164.358300] CIFS VFS: No username specified
[153164.358312] CIFS VFS: cifs_mount failed w/return code = -22

/var/log/messages seems to have no useful information.

EDIT3: OK. Thanks again to Michael I almost have it! If I put the following in /etc/fstab then it works:

//\040320H  /media/G4       cifs    user=AzureDiamond,password=hunter2       0       0


  1. I do not want my password in there...
  2. I now need to use sudo to mount the share.

How can I resolve those two issues?

share|improve this question
Can you please include additional log information? This can result from mount being unable to find the share, perhaps due to a naming error. If this were the case you should see a message similar to: !!Mapping smb error code 67 to POSIX err -6 !! – Tok Dec 15 '10 at 17:44
@Tok: Which log file(s) should I check? I posted more dmesg output but /var/log/messages has no relevant information... – Josh Dec 15 '10 at 17:50
Glad to see that things are moving forward. For reference, the dmesg log is where you want to be looking. If, in the future, you desire more verbosity try echo 1 >/proc/fs/cifs/cifsFYI – Tok Dec 15 '10 at 18:13
up vote 4 down vote accepted

The line in /etc/fstab I eventually used was:

//\040320H   /media/G4   cifs   username=master,user   0   0

What solved the issue of not being prompted for the password as well as credentials= not working was installing mount.cifs via:

sudo apt-get install cifs-utils

Just like Michael Mrozek I assumed I had mount.cifs installed or else I wouldn't be able to mount CIFS shares, but apparently the kernel will use it's own internal code to mount unless it finds mount.cifs

share|improve this answer

The filesystem is the Windows shared path, and the type is CIFS:

//file-server/ShareName /mnt/file-server-share cifs options 0 0

options can be all the usual mount options. You probably need to provide some sort of credentials; you can provide user and password options, or use credentials=/path/to/credentials/file and store username=... and password=... lines in that file (keep in mind that /etc/fstab is world-readable)

share|improve this answer
I tried credentials=/home/myusername/.g4-credentials and created .g4-credentials in my homedir (which is OK since I am using home directory encryption), but then I received the error "No username specified" via dmesg. Any idea on that vs return code -6? – Josh Dec 15 '10 at 17:46
@Josh What format is the file in? It should be "username=your-username" on one line, and "password=your-password" on another – Michael Mrozek Dec 15 '10 at 17:52
Yup, that's exactly how it is... – Josh Dec 15 '10 at 17:55
@Josh Hmm. Well, I just noticed your question edit; the problem with your old way was user and username are synonyms; you need to pick one instead of listing both. user=foo is the CIFS way, but they allow username=foo for backwards-compatibility with SMBFS – Michael Mrozek Dec 15 '10 at 18:01
@Michael almost there! See EDIT3, you were right, switching from username to user worked, but, broke user mounting... – Josh Dec 15 '10 at 18:11

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.