💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
Samba是在Linux和UNIX系统上实现SMB协议的一个免费软件。 ## 服务器端设置 查询Samba ``` yum info samba ``` 安装和配置Samba服务 ``` yum install samba -y systemctl start smb systemctl enable smb systemctl status smb ``` 创建组 ``` groupadd sales-rw groupadd sales-r ``` 创建用于共享的文件夹 ``` mkdir /share chown sales-rw:sales-rw /share chmod 775 /share ls -l / | grep share ``` 创建演示用户 ``` useradd user01 -g sales-rw -c "user01 in sales-rw group" useradd user02 -g sales-r -c "user02 in sales-r group" ``` 设置Samba用户密码 ``` smbpasswd -a user01 smbpasswd -a user02 ``` 修改配置文件vi /etc/samba/smb.conf (添加下面内容) ``` # Users in group sales-rw have read/write permission # Users in group sales-r have read permission # Others have no permission [Sales department] comment = Sales department shared folder path = /share guest ok = no writable = yes valid users = @sales-rw,@sales-r write list = sales-rw create mask = 0664 directory mask = 0775 ``` 重启Samba服务 ``` systemctl restart smb ``` 查询socket statistics状态 ``` ss -antp | grep smb ``` 设置防火墙例外 ``` firewall-cmd --permanent --add-service=samba firewall-cmd --reload firewall-cmd --list-services ``` 设置SELINUX ``` setsebool -P samba_export_all_ro=1 samba_export_all_rw=1 getsebool -a | grep samba_export ``` ## 客户端设置 图形界面(Other Locations -> Connect to Server) ``` smb://192.168.10.71/Sales department ``` 命令行 ``` mkdir /smb mount -t cifs -o username="user01",password="******" "//192.168.10.71/Sales department" /smb ```