【RedHat Linux】samba 服务器的搭建 以及 客户端配置

【samba 服务器搭建】
1. getsebool -a|grep samba
2. setsebool -P samba_export_all_rw=on &
3. yum -y install samba
4. vi /etc/samba/smb.conf
workgroup=staff
[common]
path = /common
hosts allow = 172.25.0.0/24
browseable = yes
5. mkdir /common
6. useradd harry      创建本地用户
7. pdbedit -a harry   测试创建虚拟用户

8. pdbedit -L    查看用户

 

【samba 搭建共享目录】
1. mkdir /devops
2. cp /etc/samba/smb.confg.example /etc/samba/smb.confg
2.1 vi /etc/samba/smb.confg
[devops]
path= /devops
hosts allow = 172.25.0.0/24
writable = yes
write list = chihiro
3. useradd kenji / useradd chihiro /pdbedit -a kenji / pdbedit -a chihiro
4.setfacl -m u:chihiro:rwX /devops
5 chown -R chihiro: /devops
5. firewall-cmd --get-default-zone //public
6. firewall-cmd --add-service=samba --zone=public --permanent
7 systemctl restart firewalld

 

【smb挂载】
1. yum install samba-client cifs-utils
2. systemctl start smb
3. smbclient -L 172.25.0.11 //看到 /common /devops
4. mkdir /mnt/dev
5. vi /etc/fstab
//server0.example.com/devops /mnt/dev cifs username=kenji, password=atenorth, multiuser,sec=ntlmssp,_netdev 0 0
6. mount -a
7. su student
8. cifscreds add -u chihiro 172.25.0.11
9. cd /mnt/dev
10. touch a.txt

 

【故障记录】

报错1: failed (ErrorNT_STATUS_CONNECTION_REFUSED)

解决方法: 启动smb服务

 

报错2:mount: //172.25.0.10/devops is not a valid block device

解决方法: 安装 cifs-utils

 

报错3:

mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

解决方法:服务端没创建分享目录

posted @ 2018-07-26 01:33  caya  阅读(285)  评论(0编辑  收藏  举报