samba详解
前言
前面学过了NFS,是一个网络文件系统,可以让远程连接像访问本地文件一样,在同一个网络上的多个用户间共享目录和文件系统。只不过NFS只是针对于两个linux主机,我们现在需要linux主机和windows主机都能共享,这个时候就用到了samba。
1、步骤,允许个别用户访问
1、安装下面三个包:
samba
samba-common
samba-client
yum install -y samba samba-common samba-client
2、配置samba服务器:/etc/samba/smb.conf
3、允许匿名用户访问
[global]
workgroup = workgroup server string = samba server netbios name = cwj map to guest = bad user interfaces = lo eno16777736 192.168.1.109 hosts allow = 192.168. log file = /var/log/samba/log.%m max log size = 50000 passdb backend = tdbsam security = user
[public]
comment = Public Stuff path = /home/samba public = yes writable = yes printable = no write list = +staff
检查:testparm /etc/samba/smb.conf
重启:service smb restart
分别在另外一台linux主机上和window主机上测试:
4、允许单个用户访问
a、配置
[it]
comment = it path = /it valid users = zhangsan write list = zhangsan printable = no create mask = 0755 directory mask = 0755
b、建立共享目录、添加相应用户和组
# mkdir /it # useradd zhangsan -s /sbin/nologin # cd /it # echo "12345" > abc.txt # pdbedit -a -u zhangsan #pdbedit -L ##查看Samba用户列表 # service restart ##重启Samba
c、测试:我的电脑,右键,网络映射
另一台Linux主机上测试
原创文章,作者:N24_yezi,如若转载,请注明出处:http://www.178linux.com/64344