rhel7配置samba_4.7.1,共享给所有人以及共享给指定用户

1、共享给所有人

服务端配置:

yum  -y install samba samba-client samba-common       #安装客户端

mkdir /guest                   #创建共享文件夹

chmod 777 /guest                #设置文件夹权限

chcon -R -t samba_share_t /guest         #把samba目录共享

firewall-cmd --add-service=samba --permanent           #防火墙放行

firewall-cmd --reload               #防火墙重置

 

vim /etc/samba/smb.conf         文档最下边加入 

—————————————

[guest]
path = /guest
public = yes
writable = yes

 

—————————————

 

systemctl restart smb                              #最后重启SMB服务

 

 

客户端配置:

yum install -y samba-client

smbclient //XXXX/guest      

 

2、共享给指定用户

服务端:

vim /etc/samba/smb.conf         文档最下边加入 

—————————————

[RHCE]

  path = /RHCE

  writable = no

  write list = user1

 

—————————————

yum  -y install samba samba-client samba-common       #安装客户端

mkdir /RHCE

chmod 777 /RHCE

chcon -R -t samba_share_t /RHCE

useradd user1

useradd user2

smbpass -a user1   #设置user1密码

smbpass -a user2   #设置user2密码

systemctl restart smb

firewall-cmd --add-service=samba --permanent           #防火墙放行

firewall-cmd --reload               #防火墙重置

 

客户端:

yum install -y samba-client 

yum install -y cifs-utils            #提供mount.cifs 命令

mkdir /RHCE

mount //XXXX/RHCE   /RHCE -o username=user1.password="XXX"

 

 

 

#查询命令:smbclient -L   /XXX/RHCE ....................testparm

posted on 2018-06-03 22:58  chenxf0  阅读(402)  评论(0编辑  收藏  举报

导航