share-image
ESC

使用 autofs 自动挂载 Samba

配置

[root@desktop /]# vim /etc/auto.master

增加

/smb1   /etc/auto.cifs

然后

[root@desktop /]# cp /etc/auto.misc /etc/auto.cifs

编辑 /etc/auto.cifs 添加

smb1 -fstype=cifs,credentials=/smb.mount       ://172.10.100.128/share1

这里需要根目录下有 smb.mount文件

[root@desktop ~]# cat /smb.mount
username=smbuser1
password=123456	

或者

smb1 -fstype=cifs,username=xxxx,password=xxxxx       ://172.10.100.128/share1

访问

[root@desktop ~]# cd /smb1/
[root@desktop smb1]# ls
smb1
[root@desktop smb1]# cd smb1/
[root@desktop smb1]# ls
a1  a10  a2  a3  a4  a5  a6  a7  a8  a9	

如果报权限错误,请关selinux

文章作者:阿文
文章链接: https://www.awen.me/post/3610365074.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 阿文的博客
本文于 2017-06-15 发布,已超过半年(3150天),请注意甄别内容是否已过期。