##SMB文件共享####
##1.samba服务器的安装及访问调试##
yum install samba-client samba-common.x86_64 samba.x86_64 -y
systemctl start smb
systemctl stop firewalld.service
setsebool -P samba_enable_home_dirs on
getsebool -a | grep samba
smbpasswd -a student ##student必须是本机存在的用户
测试:
##2.samba共享目录
mkdir westos
touch westos/westosfile{1..5}
vim /etc/samba/smb.conf
##########################
321 [westos] ##共享名称
322 comment = local directory westos ##共享说明
323 path = /westos ##共享目录路径
semanage fcontext -a -t samba_share_t '/westos/(/.*)?'
restorecon -FvvR /westos/
共享目录自建立目录上需要修改selinux属性,此方式修改只针对修改目录
mkdir linux
vim /etc/samba/smb.conf
########################################
324 [linux]
325 comment = local directory linux
326 path = /linux
setsebool -P samba_export_all_rw on ##可以读写
setsebool -P samba_export_all_ro on ##只读
共享系统建立目录要修改linux属性,此方式修改针对所有目录,一旦开放,selinux不保护目录访问
##3.samba匿名访问##
vim /etc/samba/smb.conf
###################################
125 map to guest = bad user ##把匿名用户映射成guest
321 [westos]
322 comment = local directory westos
323 path = /westos
324 guest ok = yes
##4.samba共享目录的管理参数##
vim /etc/samba/smb.conf
###############################
[westos]
comment = local directory westos
path = /westos
guest ok = yes
writable = yes
write list = +test
valid users = test
valid users = @test
browseable = no
##1.samba服务器的安装及访问调试##
yum install samba-client samba-common.x86_64 samba.x86_64 -y
systemctl start smb
systemctl stop firewalld.service
setsebool -P samba_enable_home_dirs on
getsebool -a | grep samba
smbpasswd -a student ##student必须是本机存在的用户
pdbedit -L ##查看用户
测试:
smbclient -L //172.25.254.120 -U student
smbclient //172.25.254.120/student -U student
##2.samba共享目录
mkdir westos
touch westos/westosfile{1..5}
vim /etc/samba/smb.conf
##########################
321 [westos] ##共享名称
322 comment = local directory westos ##共享说明
323 path = /westos ##共享目录路径
##########################
semanage fcontext -a -t samba_share_t '/westos/(/.*)?'
restorecon -FvvR /westos/
共享目录自建立目录上需要修改selinux属性,此方式修改只针对修改目录
测试:smbclient //172.25.254.120/westos -U student
mkdir linux
vim /etc/samba/smb.conf
########################################
324 [linux]
325 comment = local directory linux
326 path = /linux
#########################################
setsebool -P samba_export_all_rw on ##可以读写
setsebool -P samba_export_all_ro on ##只读
共享系统建立目录要修改linux属性,此方式修改针对所有目录,一旦开放,selinux不保护目录访问
测试:smbclient //172.25.254.120/linux -U student
##3.samba匿名访问##
vim /etc/samba/smb.conf
###################################
125 map to guest = bad user ##把匿名用户映射成guest
321 [westos]
322 comment = local directory westos
323 path = /westos
324 guest ok = yes
###################################
systemctl restart smb.service
测试:smbclient //172.25.254.120/westos
匿名挂载:
##4.samba共享目录的管理参数##
vim /etc/samba/smb.conf
###############################
[westos]
comment = local directory westos
path = /westos
guest ok = yes
writable = yes
write list = +test
valid users = test
valid users = @test
browseable = no
admin users = test
#################################
作用:
1.
、
普通用户登陆时不可写文件,输入writable = yes后可以对文件进行写操作