**服务端配置**
1.关闭防火墙,关闭selinux
```
[root@server ~]# systemctl stop firewalld
[root@server ~]# systemctl disable firewalld
[root@server ~]# setenforce 0
```
2.安装samba服务
```
[root@server ~]# yum ‐ y install samba
```
3.开启服务并设置开机自启
```
[root@server ~]# systemctl start smb nmb
[root@server ~]# systemctl enable smb nmb
```
4.创建一个共享目录
```
[root@server ~]# mkdir /123
```
5.编辑smb.conf配置文件实现/123目录共享
```
[root@server ~]# vim /etc/samba/smb.conf
[123]
comment = 123
path = /123
valid users = 123
write list = 123
```
6.检查配置文件语法
```
[root@server ~]# testparm
Load smb config files from /etc/samba/smb.conf
Global parameter security found in service section!
Global parameter passdb backend found in service section!
Loaded services file OK.
Server role: ROLE_STANDALONE
```
7.创建123用户,添加至samba共享用户
```
[root@server ~]# useradd 123
[root@server ~]# smbpasswd ‐a 123
New SMB password:
Retype new SMB password:
Added user 123.
```
8.重启服务
```
[root@server ~]# systemctl restart smb nmb
```
2. **客户端配置**
1.在客户机安装samba‐client包
```
[root@client ~]# yum ‐y install samba‐client
```
2.安装cifs
```
[root@client ~]# yum ‐y install cifs‐utils
```
3.创建挂载点,挂载
```
[root@client ~]# mkdir /mnt/hzz
[root@client ~]# mount ‐t cifs //192.168.1.1/123 /123 ‐o username=,password=123
```
挂载完成之后查看
```
[root@client ~]# df ‐h
```
永久挂载
```
[root@client ~]# vim /etc/fstab
//192.168.1.1/123 /123/ cifs multiuser,username=123,password=123
```
最后修改:2021 年 12 月 04 日
© 允许规范转载