装好了FreeNAS(FreeNAS 11.0-U4)创建cifs共享. 然而直接在qnap的NAS上通过以下命令挂载不了
mount.cifs //192.168.50.14/freenas-repo /share/Public/freenas/ --verbose -o username=****,password=****,iocharset=utf8,uid=0,gid=0
提示权限错误:
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
在askubuntu上rmanna提到是认证方式的问题. 通过如下语句成功挂载.
mount.cifs //192.168.50.14/freenas-repo /share/Public/freenas/ --verbose -o username=****,password=****,sec=ntlmssp,iocharset=utf8,uid=0,gid=0
注意新加了一个参数: sec=ntlmssp
据他的说法是: The default in mainline kernel versions prior to v3.8 was sec=ntlm. In v3.8, the default was changed to sec=ntlmssp.
而FreeNAS上没有打开"NTLMv1 auth" 选项所以报错.
服务器数据需要备份,备份存储在网络硬盘上,这块硬盘格式 ext4 , 来源于 Windows server 服务器。
然而使用 cifs 挂载失败,老是提示没有权限,我反复在 Windows 系统下测试,用户密码千真万确,然而在 ubuntu 上就是无法成功挂载。
最后终于找到问题的根本原因,密码 hash 格式不对,这样系统一直回报密码错误:
[602334.718574] CIFS VFS: cifs_mount failed w/return code = -13
解决办法,在参数列表里面加上 hash 格式:
sec=
Security mode. Allowed values are:
¡¤ none - attempt to connection as a null user (no name)
¡¤ krb5 - Use Kerberos version 5 authentication
¡¤ krb5i - Use Kerberos authentication and forcibly enable packet signing
¡¤ ntlm - Use NTLM password hashing
¡¤ ntlmi - Use NTLM password hashing and force packet signing
¡¤ ntlmv2 - Use NTLMv2 password hashing
¡¤ ntlmv2i - Use NTLMv2 password hashing and force packet signing
¡¤ ntlmssp - Use NTLMv2 password hashing encapsulated in Raw NTLMSSP message
¡¤ ntlmsspi - Use NTLMv2 password hashing encapsulated in Raw NTLMSSP message, and force
packet signing
The default in mainline kernel versions prior to v3.8 was sec=ntlm. In v3.8, the default
was changed to sec=ntlmssp.
If the server requires signing during protocol negotiation, then it may be enabled
automatically. Packet signing may also be enabled automatically if it's enabled in
/proc/fs/cifs/SecurityFlags.
我这里是 sec=ntlm
完整的可以工作的命令行:
mount -v -t cifs //192.168.2.88/data /media/backup/ -o username=backup,password=backup,iocharset=utf8,sec=ntlm
还需要注意的是用户所在 domain , 我这里是系统内用户,否则要加上 domain , 不然也会报 权限问题