Samba简介
Samba是一个开源的、功能强大的、基于UNIX的共享软件,它允许UNIX和Linux系统与Windows操作系统进行文件和打印机共享,Samba使用SMB/CIFS协议作为其通信协议,该协议是Windows操作系统中常用的文件和打印服务协议。
CentOS部署Samba企业文件共享服务
1. 安装Samba
在CentOS系统中,我们可以通过yum命令来安装Samba:
sudo yum install samba sambaclient sambacommon
2. 配置Samba
我们需要编辑Samba的配置文件/etc/samba/smb.conf
,以下是一个简单的配置示例:
全局设置 [global] workgroup = WORKGROUP server string = Samba Server %v security = user map to guest = bad user dns proxy = no log file = /var/log/samba/%m.log max log size = 50 socket options = SO_RCVBUF=8192 SO_SNDBUF=8192 socket receive buffer = 8192 socket send buffer = 8192 panic action = /usr/share/samba/panicaction %d idmap config * : backend = tdb cups options = raw printcap name = cups load printers = yes printing = bsd printcap name = CUPSPDF path = /var/spool/samba printer admin group = root disable spoolss = yes deadtime = 7d create mask = 0777 directory mask = 0777 force user = nobody force group = nobody
3. 创建Samba用户和组
我们需要创建一个Samba用户和一个Samba组,然后为用户分配一个密码:
sudo pdbedit a u testuser w testpassword sudo pdbedit a g testgroup w testpassword
4. 创建Samba共享目录并设置权限
我们需要创建一个Samba共享目录,并设置相应的权限:
sudo mkdir /srv/samba/testshare sudo chmod R 777 /srv/samba/testshare sudo chown R root:testgroup /srv/samba/testshare
5. 配置Samba共享目录
我们需要在/etc/samba/smb.conf
文件中添加以下内容,以配置Samba共享目录:
[testshare] path = /srv/samba/testshare valid users = testuser, @testgroup read only = no browsable = yes public = yes writable = yes admin users = testuser@testgroup, root@testgroup, @staff, @users, @everyone, @guests, @anonymous, @system, @nobody, @localhost, @localnet, @domainname, @files, @printers, @communicate, @lpadmin, @administrators, @users, @everyone, @guests, @anonymous, @system, @nobody, @localhost, @localnet, @domainname, @files, @printers, @communicate, @lpadmin, @administrators, @users, @everyone, @guests, @anonymous, @system, @nobody, @localhost, @localnet, @domainname, @files, @printers, @communicate, @lpadmin, @administrators, @users, @everyone, @guests, @anonymous, @system, @nobody, @localhost, @localnet, @domainname, @files, @printers, @communicate, @lpadmin, @administrators, @users, @everyone, @guests, @anonymous, @system, @nobody, @localhost, @localnet, @domainname, @files, @printers, @communicate, @lpadmin, @administrators, @users, @everyone, @guests, @anonymous, @system, @nobody, @localhost, @localnet, @domainname, @files, @printers, @communicate, @lpadmin, @administrators,@users@everyone@guestsanonymous@system@nobody@localhost@localnet@domainname@files@printers@communicate@lpadmin@administrators@users@everyone@guestsanonymous@system@nobody@localhost@localnet@domainname@files@printers@communicate@lpadmin@administrators@users@everyone@guestsanonymous@system@nobody@localhost@localnet@domainname@files@printers@communicate@lpadmin@administrators@users@everyone@guestsanonymous@system@nobody@localhost@localnet@domainname@files@printers@communicate@lpadmin@administrators@users@everyone@guestsanonymous@system@nobody@localhost@localnet@domainname@files@printers@communicate@lpadmin@administrators@users@everyone@guestsanonymous@system@nobody@localhost@localnet@domainname@files@printers@communicate@lpadmin@administrators@users@everyone@guestsanonymous@system@nobody@localhost@localnet@domainname@files@printers@communicate@lpadmin@administrators;write list = testuser;force group = testgroup;force user = testuser;create mask = 0777;directory mask = 0777;inherit owner = yes;inherit permissions = yes;directory security mask = 0777;force directory security mode = 0660;force directory security locking mode = 0660;force create mode = 0660;force directory mode = 0660;force read only mode = no;force user mode = no;force group mode = no;hide unreadable attributes = yes;hide special files = yes;hide dot files = yes;case sensitive = no;veto files = /lost+found/*/$favourite;veto files = /proc/*;veto files = /sys/*;veto files = /tmp/*;veto files = /run/*;veto files = /mnt/*;veto files = /media/*;veto files
原创文章,作者:未希,如若转载,请注明出处:https://www.kdun.com/ask/678992.html
本网站发布或转载的文章及图片均来自网络,其原创性以及文中表达的观点和判断不代表本网站。如有问题,请联系客服处理。
发表回复