标签:samba
实验环境:centos 6.6
[root@localhost ~]# yum -y install samba [root@localhost ~]# cd /etc/samba/
[root@localhost samba]# grep -v ^# smb.conf |grep -v ^\; [yunwei] comment = yunwei dirpath = /data/samba/yunwei public = no writable = yes printable = no write list = +staff browseable = yes valid user = @yunwei,maozong [test] comment = test dirpath = /data/samba/test public = no writable = yes printable = no write list = +staff browseable = yes valid user = @test,maozong [kaifa] comment = kaifa dirpath = /data/samba/kaifa public = no writable = yes printable = no write list = +staff browseable = yes valid user = @kaifa,maozong [root@localhost samba]#
[root@localhost samba]# head -n 253 smb.conf |tail -n 6 #[homes] #comment = Home Directories #browseable = no #writable = yes ;valid users = %S ;valid users = MYDOMAIN\%S [root@localhost samba]#
[root@localhost ~]# groupadd yunwei [root@localhost ~]# groupadd test [root@localhost ~]# groupadd kaifa
[root@localhost ~]# useradd -s /sbin/nologin maozong [root@localhost ~]# useradd -s /sbin/nologin -G yunwei jack [root@localhost ~]# useradd -s /sbin/nologin -G test bob [root@localhost ~]# useradd -s /sbin/nologin -G kaifa tom
[root@localhost samba]# smbpasswd -a maozong [root@localhost samba]# smbpasswd -a jack [root@localhost samba]# smbpasswd -a bob [root@localhost samba]# smbpasswd -a tom
[root@localhost ~]# mkdir -p /data/samba/yunwei [root@localhost ~]# mkdir -p /data/samba/test [root@localhost ~]# mkdir -p /data/samba/kaifa
[root@localhost ~]# chown maozong:yunwei /data/samba/yunwei/ -R [root@localhost ~]# chown maozong:test /data/samba/test/ -R [root@localhost ~]# chown maozong:kaifa /data/samba/kaifa/ -R [root@localhost ~]# chmod 770 /data/samba/* -R
[root@localhost ~]# touch /data/samba/yunwei/yunwei-test [root@localhost ~]# touch /data/samba/test/test.txt [root@localhost ~]# touch /data/samba/kaifa/kaifa.txt
[root@localhost ~]# /etc/init.d/smb restart Shutting down SMB services: [ OK ] Starting SMB services: [ OK ] [root@localhost ~]#
windows:
\\192.168.10.99
maozong账户不管那个文件夹都能进
其他的用户只能访问自己的目录
-----------------
Samba如何设置登录时不输入账号和密码
1.在[global]中添加 guest account = nobody
2.在共享中设置 guest ok = yes 或者 public = yes 或者 only guest = yes
3.重启smb服务 service smb restart
Samba用户设置空密码:
smbpasswd user
按两次回车,用户就是空密码了
在smb.conf里的global加上smb ports = 60095 60096,再重启
这时只能用smbclient连接
smbclient //ip/share -U user -p port
[share]
comment = bill
path = /path
writable = yes
browseable = yes
public = yes
valid users = user
本文出自 “鹏城-酱油瓶” 博客,请务必保留此出处http://yfshare.blog.51cto.com/8611708/1758388
标签:samba
原文地址:http://yfshare.blog.51cto.com/8611708/1758388