SMB服务端
安装
yum install -y samba
创建samba用户
useradd samba #如果使用已有系统用户无需重新创建 smbpasswd -a samba #添加smb用户必须为已有的系统用户
smb密码与shell密码无关联,可与正在使用中的用户共同使用
常用选项(其他的可自行百度)
smbpasswd -a 增加用户(要增加的用户必须以是系统用户) smbpasswd -d 冻结用户,就是这个用户不能在登录了 smbpasswd -e 恢复用户,解冻用户,让冻结的用户可以在使用 smbpasswd -n 把用户的密码设置成空. 要在global中写入 null passwords -true smbpasswd -x 删除用户
修改smb配置文件
配置文件 /etc/samba/smb.conf 添加以下配置即可,更多配置文件详解
[kxblogs] comment = SambaRoot hosts allow = 192.168.0.0/24 path = /data read only = No
开启、关闭、查看SMB状态
systemctl start smb systemctl stop smb systemctl status smb
SMB客户端
uid+gid可指定挂载后所属用户
mount -o rw,uid=xxx,gid=xxx,username=账号,password=密码 //SMB服务器IP/共享目录 /挂载点