Mounting NAS drive with cifs using credentials file through fstab does not work

Posted by mahatmanich on Server Fault See other posts from Server Fault or by mahatmanich
Published on 2012-11-04T19:35:51Z Indexed on 2012/11/04 23:02 UTC
Read the original article Hit count: 504

Filed under:
|
|
|
|

I can mount the drive in the following way, no problem there:

mount -t cifs //nas/home /mnt/nas -o username=username,password=pass\!word,uid=1000,gid=100,rw,suid

However if I try to mount it via fstab I get the following error:

//nas/home /mnt/nas cifs  iocharset=utf8,credentials=/home/username/.smbcredentials,uid=1000,gid=100  0        0 auto

.smbcredentials file looks like this:

username=username
password=pass\!word

Note the ! in my password ... which I am escaping in both instances

I also made sure there are no eol in the file using :set noeol binary from Mount CIFS Credentials File has Special Character

chmod on .credentials file is 0600 and chown is root:root file is under ~/

Why am I getting in on the one side and not with fstab??

I am running on ubuntu 12 LTE and mount.cifs -V gives me mount.cifs version: 5.1

Any help and suggestions would be appreciated ...

UPDATE: /var/log/syslog shows following

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

UPDATE no 2

Debugging with strace mount through fstab:

strace -f -e trace=mount mount -a
Process 4984 attached
Process 4983 suspended
Process 4985 attached
Process 4984 suspended
Process 4984 resumed
Process 4985 detached
[pid  4984] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid  4984] mount("//nas/home", ".", "cifs", 0, "ip=<internal ip>,unc=\\\\nas\\home"...) = -1 EACCES (Permission denied)
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Process 4983 resumed
Process 4984 detached

Mount through terminal

strace -f -e trace=mount mount -t cifs //nas/home /mnt/nas -o username=user,password=pass\!wd,uid=1000,gid=100,rw,suid
Process 4990 attached
Process 4989 suspended
Process 4991 attached
Process 4990 suspended
Process 4990 resumed
Process 4991 detached
[pid  4990] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid  4990] mount("//nas/home", ".", "cifs", 0, "ip=<internal ip>,unc=\\\\nas\\home"...) = 0
Process 4989 resumed
Process 4990 detached

© Server Fault or respective owner

Related posts about linux

Related posts about ubuntu