Linux--Smba服务搭建
Posted zynet
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux--Smba服务搭建相关的知识,希望对你有一定的参考价值。
Samba文件共享服务
服务功能:跨平台文件共享
1.环境部署
ip=192.168.1.50
[[email protected] 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)创建共享目录
[[email protected] /]# mkdir /sherlock
[[email protected] /]# touch /sherlock/sherlock.txt
3)设置用户访问授权
[[email protected] /]# 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)设置目录访问授权
[[email protected] /]# chmod 777 /sherlock
[[email protected] /]# vi /etc/samba/smb.conf
[tools]
directory mask=0755 --上传目录的默认权限为0755
create mask=0644 --上传文件的默认权限为0644
3.创建用户映射
[[email protected] /]# vi /etc/samba/smbusers
faker=qwe,qqq --指定用户faker的别名
[[email protected] /]# vi /etc/samba/smb.conf
[global]
[[email protected] /]# service smb restart --重启服务
PS:蓝色为修改部分,红色为添加部分
以上是关于Linux--Smba服务搭建的主要内容,如果未能解决你的问题,请参考以下文章