使用凭证文件通过fstab安装NAS驱动器与cifs不起作用

我可以用下面的方法安装驱动器,没有问题:

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

但是,如果我尝试通过fstab挂载它,我得到以下错误:

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

.smbcredentials文件如下所示:

 username=username password=pass\!word 

注意! 在我的密码…我在这两个实例逃脱

我也确定在文件中没有使用eol :set noeol binary mount CIFS Credentials File中的 :set noeol binary 具有特殊字符

chmod on .credentials文件是0600chownroot:root文件在~/

为什么我进入一边而不是用fstab?

我运行在Ubuntu 12 LTE和mount.cifs -V给我mount.cifs版本:5.1

任何帮助和build议,将不胜感激…

更新: /var/log/syslog显示如下

 [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 

更新否2

用fstab通过strace挂载进行debugging:

 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 (eg man mount.cifs) Process 4983 resumed Process 4984 detached 

通过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 

这是我错过的variables用户名的拼写错误。 不知怎么的,你从strace呼叫中可以看到缺less的东西:

  [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 –