0%

Ubuntu 自动挂载Samba服务器

首先安装这个工具

1
apt install cifs-utils

不然之后会提示

1
(for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program)

创建一个凭证文件, 可以放在任何位置 e.g.

1
nano /etc/sambapin

文件内容为

1
2
3
username=xxx
password=xxx
domain=xxx

根据相关的字段填写对应的值,domain可以填写DOMAIN

e.g.

1
2
3
username=admin
password=xxxxxx
domain=DOMAIN

然后编辑/etc/fstab新增一行

1
//172.16.100.5/Downloads /home/download/Downloads cifs credentials=/etc/sambapin 0 0

表示将//172.16.100.5/Downloads这个目录挂载到本地的/home/download/Downloads

如果出现错误提示

1
2
mount error(95): Operation not supported
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

有可能的原因是需要设置协议版本

1
//172.16.100.5/Downloads /home/download/Downloads cifs credentials=/etc/sambapin,vers=1.0 0 0

如上, 在credentials=/etc/sambapin后加上协议版本即可

https://www.cnblogs.com/hpcpp/p/7483397.html

https://www.truenas.com/community/threads/mounting-smb-with-ubuntu-mount-error-95.71137/

https://askubuntu.com/questions/525243/why-do-i-get-wrong-fs-type-bad-option-bad-superblock-error