共享名 物理路径 权限
public /pub 任何人 ro
smbgjp /gjp gjp rw
smblzw /lzw lzw rw
2.准备知识:
本地权限 网络权限
相同 相同
不同 最小
ro ro ---》ro
rw ro ---》ro
3.具体配置:
[root@gjp99 ~]# mkdir /pub /gjp /lzw
[root@gjp99 ~]# ll -d /pub /gjp /lzw
drwxr-xr-x 2 root root 4096 Aug 3 17:22 /gjp
drwxr-xr-x 2 root root 4096 Aug 3 17:22 /lzw
drwxr-xr-x 2 root root 4096 Aug 3 17:22 /pub
创建账号,可以不设置密码,因为访问samba使用的是samba账号!
[root@gjp99 ~]# useradd gjp
[root@gjp99 ~]# useradd lzw
必须有本地账号,才会有samba账号!
[root@gjp99 ~]# chown gjp.gjp /gjp
[root@gjp99 ~]# chown lzw.lzw /lzw
[root@gjp99 ~]# ll -d /pub /gjp /lzw
drwxr-xr-x 2 gjp gjp 4096 Aug 3 17:22 /gjp
drwxr-xr-x 2 lzw lzw 4096 Aug 3 17:22 /lzw
drwxr-xr-x 2 root root 4096 Aug 3 17:22 /pub
为了访问时有提示信息,所以在每个目录中设置了相应的文件
[root@gjp99 ~]# cd /gjp
[root@gjp99 gjp]# touch f1.gjp
[root@gjp99 gjp]# cd /lzw
[root@gjp99 lzw]# touch f1.lzw
[root@gjp99 lzw]# cd /pub
[root@gjp99 pub]# touch f1.public
samba 账号的创建:
[root@gjp99 ~]# vim /etc/samba/smb.conf
265 [public]
266 comment = public dir
267 path = /pub
268 browseable = yes
269 guest ok = yes
270 writable = no
271 printable = yes
272 [smbgjp]273 comment = gjp share dir
274 path = /gjp
275 browseable = yes
276 guest ok = no
277 valid users = gjp
278 writable = yes
280 [smblzw]281 comment = lzw share dir
282 path = /lzw
283 browseable = yes
284 guest ok = no
285 valid users = lzw
286 writable = yes
必须事先创建好本地账号,才能创建smb账号!
[root@gjp99 pub]# smbpasswd -a gjp
New SMB password:输入密码:123
Retype new SMB password:
Added user gjp.
[root@gjp99 pub]# smbpasswd -a lzw
New SMB password:
Retype new SMB password:
Added user lzw.
[root@gjp99 pub]# service smb restart
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
用一个账号访问过之后,再次访问时,最好注销下!