Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 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:


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


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
share|improve this question
Unless you have a typo in your post you are not escaping the ! in both cases. The escape character is the backslash \ , not the forward slash /. – Ansgar Wiechers Nov 4 '12 at 20:31
Are you sure the password should be escaped in the credentials file? It's a shell metachar, which is why it has to be escaped on the command line but how will it be misinterpreted in the credentials file without escaping? Also I can't see any error message in your post, just command to mount and a line from fstab, no error message. – ptman Nov 4 '12 at 20:50
you can check for open() and read() syscalls using strace – ptman Nov 4 '12 at 20:54
you are asking strace to not show open calls, try using -e trace=open,read instead or leave -e trace out and direct the output to a file that you can examine afterwards. – ptman Nov 4 '12 at 21:27
also try giving the -o credentials=$file to mount when calling on the command line instead of -o username=...,password=..., so that the two calls are as close to each other as possible – ptman Nov 4 '12 at 21:29
up vote 1 down vote accepted

It was a typo of the variable username that I missed. Somehow the s was missing as you can see from the strace call:

 [pid 5240] getgid32() = 0 [pid 5240] access("/etc/smbcredentials", R_OK) = 0 [pid 5240]
 open("/etc/smbcredentials", O_RDONLY) = 3 
 [pid 5240] fstat64(3, {st_mode=S_IFREG|0777,st_size=41, ...}) = 0 
 [pid 5240] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77d0000 
 [pid 5240] read(3, "uername=username\npassword=password"..., 4096) = 41 –
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.