centos7 配置smb共享存储

server0首先装软件 

yum install samba samba-client -y

vim /etc/samba/smb.conf

在文件末尾添加配置

[share]   #共享目录名称

path = /public   #共享目录路径

browseable = yes   #允许访问

添加samba用户

smbpasswd - a testuser

开启防火墙和selinux权限后,客户端即可访问共享目录。

 

desktop0安装samba客户端后,测试:

smbclient -L server0   #查看server0上的smb共享目录,然后挂在远程目录到本地即可使用

yum -y install cifs-utils    #首先安装文件系统cifs

mount //server0.example.com -o username=testuser,password=redhat /mnt    #手动挂载远程目录到本地。

 

安装autofs实现自动挂载:

 yum -y install autofs

vim /etc/auto.master   #编辑配置文件,指定自动挂载二级配置文件路径

/-  /etc/auto.share  #主配置文件末尾添加一行,指定使用绝对路径、新配置文件是/etc/auto.share

cp /etc/auto.misc /etc/auto.share  #复制一份配置文件模板并编辑

vim /etc/auto.share  #添加如下内容

/mnt/share  -fstype=cifs,username=testuser,password=redhat  ://server0.example.com/share

猜你喜欢

转载自www.cnblogs.com/ValyrianSteel/p/12759954.html