How to mount Windows share on boot using mount.cifs and autofs/automount?
Solution 1
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
Solution 2
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
.
Related videos on Youtube
Comments
-
Rob over 1 year
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
andls /mnt/mountpoint
to determine whether autofs succeeds in mounting the share (it does not.) The result fromdmesg
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!
-
Rob about 13 yearsI am using method 3 of the CentOS wiki at centos.org/modules/newbb/viewtopic.php?topic_id=12716 , which says that "/etc/auto.mymount can be made world-unreadable, so, use of the credentials file is not as important." I have also tried using just the username without DOMAIN\, with the same result, so I don't believe that is the cause. However, I will try your settings soon (and accept the answer if it works.)
-
Rob about 13 yearsThis didn't solve my issues, although it seems that
auto.master
isn't being used (I now believe the CIFS VFS errors were from previous failed attempts usingfstab
.) However, I was able to get it working with/etc/fstab
and a separate credentials file. -
JSancho about 11 yearsThat's what's done it for me. mount was not appreciating the domain\user backslash. Using the domain as another parameter worked just fine