-   Linux - Server (
-   -   Mounting Windows share (

leupi 04-08-2008 02:41 PM

Mounting Windows share
I am trying to mount a windows share to an Ubuntu 7.10 workstation and am having some issues. If I go into Nautilus and enter the following into the Location bar I have no problem and can see my files:

I need to enter my username, password, and domain at the next prompt, but it then works.

I would like to just add an entry into etc/fstab so that at boot it is mounted to /server; however, I only get a permission denied when I try as such:

//        /server        smbfs        defaults        0        0
I get:

5784: session setup failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed

How can I set this up so that I can auto mount it at startup?


kyriakos 04-08-2008 07:33 PM

smbclient //host/share password -U user

and read man smbclient and smbmount

if you manage with smbclient then just put it in /etc/rc.local

leupi 04-11-2008 01:58 PM

Thanks for the reply; however, it is still not working. When I try it your way I get:

session setup failed: NT_STATUS_LOGIN_FAILURE
As far as I can see by the man pages I am doing it correctly (obviously I am not though...)

Any other thoughts? I would love to be able to use Linux at work, but if I cannot connect to the server it won't happen :(


leupi 04-11-2008 02:29 PM

I also tried:

sudo mount -t cifs //wollemi/users/me /server --verbose -o user=me
and I get:

mount.cifs kernel mount options unc=//wollemi\users,ip172.16.4.23,pass=password,ver=1,rw,user=me,prefixpath=me
mount error 20 = Not a directory
Refer to the mount.cifs(8) manual page ( mount.cifs)

I looked at the man pages, but again, I cannot see what I am doing wrong.


p_s_shah 04-11-2008 02:55 PM

Check the link :

dbmacartney 04-11-2008 03:13 PM

you mentioned using nautilus. are you only wanting to use is as the user which is currently logged in? you can go to your places menu and click connect to server. this wont give you your traditional mountpoint though. but you've almost got it.

the command to run is
sudo mount -t cifs -o username=me //server/share /path/to/mountpoint

to add it persistently after a reboot you need to have a credentials file where you save your username and password to.

//server/share /mnt/share cifs defaults,credentials=/root/.credentials 0 0

make sure your .credentials file is only readable by root, you dont want your password being found by any other user.

alternatively if you wish to have it mounted when an individual profile is loaded, you can use a login script.
check out the below link, it describes some good details about automatic mounting of SMB shares.

leupi 04-11-2008 03:16 PM

I tried that and got the error message:

6686: session setup failed: ERRDOS - ERRnoaccess (access denied.)
SMB connection failed


jschiwal 04-11-2008 03:16 PM

First, make sure to use "smbpasswd" to add an entry of the windows user to /etc/samba/smb.conf.
Then use the credentials option to refer to a credentials file containing your using name and password in


Put the password somewhere safe such as /home/<yourusername>/.credentials. Make sure it is readable only by you and that you don't allow global access to your personal home directory.
Also use "cifs" as the filetype in /etc/fstab.

If the remote share is on a Vista machine, make sure that Samba is updated to a recent version.
Also check that you are using the correct credentials for the share.

leupi 04-11-2008 03:39 PM

In doing that (trying to set a password) I get the message:

Could not connect to maching NT_STATUS_LOGIN_FAILURE
Failed to change password for tparks

I will actually need to add a user to Samba as I have a different username to log into the Windows server than the one that I use to login to my local machine.

I appreciate the insight. Can you guide me a bit more in getting Samba set up? I will not be able to do much more for a couple of weeks as I am leaving town for a week and will not have access to this computer. Just don't want anyone to think that they are getting ignored as I appreciate all of the help given to me :)


jschiwal 04-11-2008 05:37 PM

Look at the "-a" option to smbpasswd. It will add and entry rather than just change one. You will need to point to a credentials file in your /etc/fstab entry that uses the credentials of that windows user rather than your own linux user. If you are sharing files back and forth, having the same username/password in both systems would be a good idea. When accessing the Samba server, the user trying to write the samba share needs Linux permissions to do so. If that user is not a Linux user, the share needs to allow guest access and "bad user = guest" needs to be used in smb.conf.

I'd recommend using swat to set up the samba server.
First you need to enable the swat service (i.e. enable it in /etc/xinetd.d/swat). If your system uses chkconfig you can use:
sudo /sbin/chkconfig swat on. This will remove the top "disable = yes" line. When you are done you can use "sudo /sbin/chkconfig swat off". This will add "disable = yes" to the top off the swat config file.
Then point your web browser to "http://localhost:901".

leupi 04-12-2008 08:36 AM

I appreciate the advice and as soon as I get back in a week I will try out what you recommend. I wanted to use the same username/password combination on my laptop as on the server for the reasons that you stated; however, my username on the windows server has an underscore (_) in it and when I tried to use that as a username in Ubuntu, the system complained. Hence the reason that I have different usernames.

Seems strange that I can browse to the Windows server and see all of my files with no problem using Nautilus yet I am having to jump through hoops to get it mounted. Ah well, look at all that I am learning...

Thanks again,

All times are GMT -5. The time now is 07:59 PM.