Samba共享服务
方式一:
1. 按照部门提供共享文件;
2. 所有共享文件可读,但不可写;
3. 共享文件由专人维护,可写;
步骤
0. 安装
yum -y install samba samba-client
1. 添加系统用户
useradd samba
2. 配置smb用户
smbpasswd -a samba
#输入两次密码
New SMB password:
Retype new SMB password:
Added user samba.
3. 更改权限(共享可读)
chmod -R 755 /home/samba/
4. 编辑配置
vim /etc/samba/smb.conf
#配置文件类似如下
[samba]
comment = samba
path = /home/samba
public = yes
writable = no
5. 重启服务
systemctl restart smb
方式二:
1. 按照samba系统用户分为管理用户和普通访问用户(均已账户密码登录);
2. 所有共享文件普通用户访问可读并下载但不可写;
3. 共享文件由管理账户维护,可写;
(本文samba为管理账户,guest为普通访问账户)
步骤
0. 安装
yum -y install samba samba-client
1. 添加系统用户
useradd guest
useradd samba
2. 配置smb管理账户和普通账户的密码
(1)smbpasswd -a guest
#输入两次密码
New SMB password:
Retype new SMB password:
Added user guest.
(2)smbpasswd -a samba
#输入两次密码
New SMB password:
Retype new SMB password:
Added user samba
3.更改属组和属主
chown samba:samba /home/samba/
4. 更改权限(共享可读)
chmod -R 775 /home/samba/
5. 编辑配置
vim /etc/samba/smb.conf
#配置文件类似如下
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
[samba]
comment = samba
path = /home/samba/
writable = no
guest ok = yes
valid users = samba,guest
write list = samba
5. 重启服务
systemctl restart smb