从网上及书籍上学习后一些步骤总结,方便下次浏览
vm镜像redhat5.3-server
Samba服务器,需要3个安装包samba-3.0.33-3.7.e15、samba-common-3.0.33-3.7.e15、samba-client-3.0.33-3.7.e15
实验要求test组、system组、product组每个组有私有文件,其他组不能访问,public公共文件,所有人可写,date文件所有人只读
一 安装包:
1:挂载cdrom到mnt下:mount /dev/cdrom /mnt
2:进入RPM所在包目录我的在Server下:cd /mnt/Server
3:查看相关版本的samba包:ls | grep samba找到以上相似的包
4:安装samba rpm包:rpm–ivh samba-3.0.33-3.7.e15.rpm、rpm–ivh samba-common-3.0.33-3.7.e15、rpm–ivh samba-client-3.0.33-3.7.e15
(eg:rpm –qa | grep samba查看已安装的samba相关包)
//使用本地yum安装最后接上步骤五,不过我能力有限redhat搭建不起本地yum,故换了镜像为Centos6.6
二 准备用户和共享文件:
首先添加linux用户组:groupadd system
groupadd test
groupadd product
创建linux用户病添加到相应组
useradd system01 –g system
useradd test01 –g test
useradd product01 –g product
在linux创建共享文件
mkdir /home/samba/test
mkdir /home/samba/public
mkdir /home/samba/product
mkdir /home/samba/date
设置权限:chmod 777 /home/samba/test
chmod 777 /home/samba/punlic
chmod 777 /home/samba/product
chmod 777 /home/samba/date
设置文件所属用户和组:chown test01:test /home/samba/test
chown product01:product /home/samba/product
三 改写配置
安装samba的rpm包好后进行配置(/etc/samba/smb.conf)
vi /etc/samba/smb.conf
[globa]
Workgroup = WORKGROUP #我的工作组
Security = user #使用用户验证(security=share则可不输密码访问共享)
[home]
Comment = home
Browseable = no
Writable = yes
Valid users = %s
#满足每个用户可以访问自己宿主目录,其他人看不到
[test]
Comment = test
Path =/home/samba/test
Public = no
Valid users =@test,system01
Write list=test
Browseable = no
#test组合system组能看到,只有test能写
[public]
Comment = public
Path =/home/samba/public
Public = yes #显示在公共区域
Writable = yes
[date]
Comment = date
Path =/home/samba/date
Public = yes #显示在公共区域
Read only =yes
四 添加到samba用户
smbpasswd -a test01
Password testtest(用于共享验证)
Retrypassword testtest
smbpasswd -a system01
Passwordd systemsystem
smbpasswd -a produce01
passwordd productproduct
retrypassword productproduct
5、W7 win+r \\ip
若出现找不到路径
vi /etc/selinux/config
SETLINUX=0或SETLINUX=DISABLE
输入setenforce 0或重启关闭setlinux
关闭防火墙:service iptables stop
五:Centos6.6yum配置samba服务器
前提要搭建cdrom为yum本地源
yum -y install samba
编辑/etc/samba/smb.conf参考上面改写