Samba文件共享服务
服务功能:跨平台文件共享
1.环境部署
ip=192.168.1.50
[root@localhost Packages]# rpm -ivh samba-3.6.9-164.el6.x86_64.rpm
2.构建Samba服务
两种共享模式:
匿名共享
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = share
passdb backend = tdbsam
load printers = yes
cups options = raw
[homes]
comment = Home Directories
browseable = no
writable = yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
[share]
path=/share
public=yes
read only=yes
测试
使用windows客户端访问共享
需用户验证的共享
1)创建共享验证用户
useradd faker --创建系统用户
useradd sherlock --创建系统用户
pdbedit -a -u faker --添加为Samba共享用户
pdbedit -a -u sherlock --添加为Samba共享用户
pdbedit -L --查看所有Samba用户
2)创建共享目录
[root@localhost /]# mkdir /sherlock
[root@localhost /]# touch /sherlock/sherlock.txt
3)设置用户访问授权
[root@localhost /]# vi /etc/samba/smb.conf
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = user
passdb backend = tdbsam
load printers = yes
cups options = raw
[tools]
path=/sherlock
public=no
read only=yes
valid users=faker,sherlock
write list=faker
4)设置目录访问授权
[root@localhost /]# chmod 777 /sherlock
[root@localhost /]# vi /etc/samba/smb.conf
[tools]
directory mask=0755 --上传目录的默认权限为0755
create mask=0644 --上传文件的默认权限为0644
3.创建用户映射
[root@localhost /]# vi /etc/samba/smbusers
faker=qwe,qqq --指定用户faker的别名
[root@localhost /]# vi /etc/samba/smb.conf
[global]
[root@localhost /]# service smb restart --重启服务
PS:蓝色为修改部分,红色为添加部分