502
个编辑
更改
无编辑摘要
[[category:IS]]
#: sudo vi /etc/samba/smb.conf
#: [rpi_web_notebooks]
## -- create mask = 0777
## -- directory mask = 0777
#: sudo systemctl start smb
#: sudo systemctl enable smb.service # 设置开机启动
#: sudo systemctl status smb
#: sudo firewall-cmd --zone=public --add-port=139/tcp --permanent
#: sudo firewall-cmd --zone=public --add-port=445/tcp --permanent
#: sudo firewall-cmd --reload
#: sudo systemctl restart firewalld.service
=配置文件共享、用户、samba=
# 创建共享目录:
#: mkdir /share
# 创建用户组和用户:
#: groupadd samba
#: useradd -g samba share
#: passwd share
# 添加samba文件共享用户
#: smbpasswd -a share
# 修改samba配置
#: vi /etc/samba/smb.conf
# 内容修改为:
#: [global]
#: workgroup = SAMBA
#: security = user
#: map to guest = Bad User
#: log file = /var/log/samba/log.%m
#: [public]
#: comment = Public Directories
#: valid users = @samba
#: read only = Yes
#: path = /share
#: hosts allow = 192.168.
# 注:secutity用来指定安全模式,user模式是需要账号密码来登录共享的
## valid users = @用户组,用来指定允许登录的用户组
## path指定共享的路径
## hosts allow用来指定开放的ip段,当前指定的是对192.168下的所有ip都开放
=重启samba服务=
systemctl restart smb.service
testparm
=客户端进行文件挂载=
mkdir /share
mount -t cifs //文件服务器ip/public /share -o "username=share,password=xxx"