我想用/etc/systemd/system
File 挂载共享:mnt-win7_docs.mount
内容 :
[Unit]
Description=Mount docs
[Mount]
What=//192.168.1.5/docs/
Where=/mnt/win7_docs/
Type=cifs
Options=user,username=<user>,password='<passwd>',iocharset=utf8
[Install]
WantedBy = multi-user.target
当我尝试时systemctl start mnt-win7_docs.mount
我有以下错误:
mnt-win7_docs.mount - Mount docs
Loaded: loaded (/etc/systemd/system/mnt-win7_docs.mount; enabled)
Active: failed (Result: exit-code) since mar. 2016-09-06 14:59:00 CEST; 2s ago
Where: /mnt/win7_docs
What: //192.168.1.5/docs/
Process: 36306 ExecMount=/bin/mount -n //192.168.1.5/docs/ /mnt/win7_docs -t cifs -o user,username=<user>,password='<passwd>',iocharset=utf8 (code=exited, status=32)
sept. 06 14:59:00 dtools mount[36306]: mount error(13): Permission denied
sept. 06 14:59:00 dtools mount[36306]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
sept. 06 14:59:00 dtools systemd[1]: mnt-win7_docs.mount mount process exited, code=exited status=32
sept. 06 14:59:00 dtools systemd[1]: Failed to mount Mount docs
sept. 06 14:59:00 dtools systemd[1]: Unit mnt-win7_docs.mount entered failed state.
但是当我尝试时/bin/mount -n //192.168.1.5/docs/ /mnt/win7_docs -t cifs -o user,username=<user>,password='<passwd>',iocharset=utf8
:
没关系 ...
你有什么想法吗?
答案1
最后,它起作用了。
问题应该出在密码中的特殊字符上。
我现在有 :
[Unit]
Description=Mount docs
[Mount]
What=//192.168.1.5/docs/
Where=/mnt/win7_docs/
Type=cifs
Options=user,credentials=/root/.credentials,iocharset=utf8
[Install]
WantedBy = multi-user.target
/root/.credentials
username=<user>
password=<password>
所以,密码没有简单的引号。