How to mount Windows share on boot using mount.cifs and autofs/automount?

2

I'm having some trouble mounting a network share using autofs. I have added the following line to /etc/auto.master:

/mnt/mountpoint       /etc/auto.servername

I then created the file /etc/auto.servername with the following contents:

server-ip -fstype=cifs,rw,noperm,user=DOMAIN\username,pass=password ://server-ip/share

I then run service autofs restart and ls /mnt/mountpoint to determine whether autofs succeeds in mounting the share (it does not.) The result from dmesg is:

CIFS VFS: Send error in SessSetup = -13
CIFS VFS: cifs_mount failed w/ return code = -13
Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE

However, if I simply run mount -t cifs //server-ip/share /mnt/mountpoint -o user=username and enter the password on prompt, the share is mounted without any problems. I have verified the correct password is /etc/auto.servername.

Any ideas what I'm doing wrong? Thanks!

centos
centos5
cifs
automount
autofs
asked on Server Fault Apr 19, 2011 by Rob • edited Oct 10, 2011 by Rob

2 Answers

2

change

server-ip -fstype=cifs,rw,noperm,user=DOMAIN\username,pass=password ://server-ip/share

to

share -fstype=cifs,rw,noperm,user=username,pass=password,domain=domain ://server-ip/share

answered on Server Fault Nov 8, 2012 by asdfasdfasdf • edited Nov 8, 2012 by HopelessN00b
1

I would guess that maybe you aren't escaping your credentials correctly in the file. The \ in the username may be breaking things. I use a credentials file, I believe it is much safer.

This are the files I use to auto-mount a particular share.

/etc/auto.master

/.autofs/cifssrvername /etc/auto.cifssrvername --timeout=600

/etc/auto.cifssrvername

share   -fstype=cifs,credentials=/etc/samba/.smbauth/smb.authfile.cifssrvername,uid=0,gid=0,file_mode=0664,dir_mode=0775 ://cifssrvername/share

I store my credentials in a separate file so I can set better permissions (0400).

/etc/samba/.smbauth/smb.authfile.cifssrvername

username=domain\user
password=...

The filesystem is then visible in /.autofs/cifssrvername/share.

answered on Server Fault Apr 19, 2011 by Zoredache

User contributions licensed under CC BY-SA 3.0