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'm trying to set up fstab to automatically connect to my office shared server. I'm undoubtedly doing something silly here as the username and password and server name work fine in the first code snippet below, just not the second - any help would be appreciated!

The following command works as expected...

tom@tom-desktop: sudo /usr/bin/smbclient -L Server.local -Uguest
Enter guest's password: 
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.10]

        Sharename       Type      Comment
        ---------       ----      -------
        Lacie Disk      Disk      macosx
        Server          Disk      macosx
        IPC$            IPC       IPC Service (Server)
        ADMIN$          IPC       IPC Service (Server)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.10]

        Server               Comment
        ---------            -------
        SERVER               Server

        Workgroup            Master
        ---------            -------
        WORKGROUP            ACER-9D60040D10

But when i add the following line to /etc/fstab, i get this error: cifs_mount failed w/return code = -22

//Server.local/Server  /media/maguires  cifs  username=guest,password=password  0  0
share|improve this question
up vote 1 down vote accepted

Try changing the line to specify that you're using a guest user, perhaps?

//Server.local/Server  /media/maguires  cifs  guest,users  0  0

the users tag will allow you mount/unmount it as a standard user.

Alternatively, try specifying guest, but keep the password blank :

//Server.local/Server  /media/maguires  cifs  username=guest,password=,users  0  0

Also, many people have reported that smbfs doesn't work so well with hostnames specified in /etc/fstab. Perhaps try changing Server.local reference to an IP address. (NB : This is still worth doing EVEN IF you have name resolution working, either through /etc/hosts or a relevant DNS entry.)

[Edit - didn't read Christopher's comments on this issue. Worth keeping in though]

Hope this helps.

share|improve this answer
First suggestion worked a treat, many thanks @Scaine. – user10160 Feb 4 '11 at 9:41

I think mount error 22 = invalid argument? Try IP address instead of Server.local. Install the network file system:

sudo apt-get install smbfs
share|improve this answer
I get the same error when I use the IP address, with either // or // – user10160 Feb 3 '11 at 15:33
So I suppose we need the the mount.cifs client: 'sudo apt-get install smbfs' – user8290 Feb 3 '11 at 15:50
Thanks @Christopher - making some progress. Now when I use server.local/server and try mount -a, i get: [280980.106979] CIFS VFS: Send error in SETFSUnixInfo = -5 [280980.106984] CIFS VFS: Negotiating Unix capabilities with the server failed. Consider mounting with the Unix Extensions [280980.106985] disabled, if problems are found, by specifying the nounix mount option. I'm going to look into this and hopefully sort it – user10160 Feb 3 '11 at 17:01

You may have to switch the slashes in your command to the backslashes, like so:

\\\\Server.local\\Server  /media/maguires  cifs  username=guest,password=password  0  0

Note the doubling of all of the slashes; backslash is an escape character, so to get a literal backslash you have to escape it with another one.

Hope that helps!

share|improve this answer

Your Answer


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