CentOS 7中Samba服务安装和配置
时间:2015-07-22 23:57 来源:51cto.com 作者:IT
-
初步说明
net config workstation
notepad C:\Windows\System32\drivers\etc\hosts
[...]
192.168.0.100 server1.example.com centos
-
Samba匿名共享
yum install samba samba-client samba-common
1
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
vi /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
#============================ Share Definitions ==============================
[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no
:wq#保存并退出
mkdir -p /samba/anonymous
systemctl enable smb.service
systemctl enable nmb.service
systemctl restart smb.service
systemctl restart nmb.service
[root@server1 ~]# firewall-cmd --permanent --zone=public --add-service=samba
success
[root@server1 ~]#
[root@server1 ~]# firewall-cmd --reload
success
[root@server1 ~]#
\\centos
ls -l
cd /samba
chmod -R 0755 anonymous/
chown -R nobody:nobody anonymous/
ls -l anonymous/
chcon -t samba_share_t anonymous/
ls -l anonymous/
-
安全的Samba服务器
groupadd smbgrp
useradd srijan -G smbgrp
smbpasswd -a srijan
[root@server1 samba]# smbpasswd -a srijan
New SMB password:<--yoursambapasswordRetype new SMB password:<--yoursambapasswordAdded user srijan.
[root@server1 samba]#
mkdir -p /samba/secured
cd /samba
chmod -R 0777 secured/
chcon -t samba_share_t secured/
vi /etc/samba/smb.conf
[...]
[secured]
path = /samba/secured
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
systemctl restart smb.service
systemctl restart nmb.service
testparm
[root@server1 samba]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[Anonymous]"
Processing section "[secured]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions <--ENTER[global]
netbios name = CENTOS
server string = Samba Server %v
map to guest = Bad User
dns proxy = No
idmap config * : backend = tdb
[Anonymous]
path = /samba/anonymous
read only = No
guest ok = Yes
[secured]
path = /samba/secured
valid users = @smbgrp
read only = No
[root@server1 samba]#
cd /samba
chown -R srijan:smbgrp secured/
chcon -h system_u:object_r:forderA /path/to/B
(责任编辑:IT)
(责任编辑:IT) |






