1月7日samba作业

一.新建cover,team,user三个组及其用户。并设置smb密码。
groupadd cover
groupadd team
groupadd user
useradd -g cover cover01
useradd -g cover cover02
seradd -g team team01
useradd -g team team02
useradd -g user user01
useradd -g user user02
smbpasswd -a cover01
smbpasswd -a cover02
smbpasswd -a team01
smbpasswd -a team02
smbpasswd -a user01
smbpasswd -a user02
二.在/media下新建文件夹cover,team,public.
mkdir  cover
mkdir  team
mkdir  public
修改/media的权限为777
chmod 777 /media

[root@localhost media]# chmod 1777 /media/public/
修改配置文件vim /etc/samba/smb.conf
添加字段:
[cover]
path = /media/cover
browseable = NO
valid users = cover01 cover02
writeable = yes

[team]
path = /media/team
read list = user01 cover01 cover02 
valid users = team01 team02 user01  cover01 cover02
writeable = yes

[public]
path = /media/public
valid list = user01 user02 team01 team02 cover01 cover02
writeable = yes

三.
重启服务
service  smb restart
四.验证
分别用不同用户登录验证。
smbclient -L 192.168.18.67
回显:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5.1]

        Sharename       Type      Comment
        ---------       ----      -------
        team            Disk     
        public          Disk     
        IPC$            IPC       IPC Service (Samba Server Version 3.0.33-3.29.el5_5.1)

smbclient //192.168.18.67/cover -U cover01
回显:Password:
Domain=[LOCALHOST] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5.1]
smb: \> put b.txt
putting file b.txt as \b.txt (2.6 kb/s) (average 2.6 kb/s)
smb: \> ls
  .                                   D        0  Mon Jan  7 16:35:52 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013
  b.txt                               A       16  Mon Jan  7 16:35:52 2013

                35697 blocks of size 524288. 28216 blocks available

smbclient //192.168.18.67/cover -U cover02
Password:
Domain=[LOCALHOST] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5.1]
回显:smb: \> ls
  .                                   D        0  Mon Jan  7 16:35:52 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013
  b.txt                               A       16  Mon Jan  7 16:35:52 2013

                35697 blocks of size 524288. 28216 blocks available
smb: \> rm -rf b.txt
NT_STATUS_NO_SUCH_FILE listing \-rf
smb: \> ls
  .                                   D        0  Mon Jan  7 16:35:52 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013
  b.txt                               A       16  Mon Jan  7 16:35:52 2013

                35697 blocks of size 524288. 28216 blocks available

smb: \> put a.txt
putting file a.txt as \a.txt (4.4 kb/s) (average 4.4 kb/s)
smb: \> ls
  .                                   D        0  Mon Jan  7 16:38:14 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013
  b.txt                               A       16  Mon Jan  7 16:35:52 2013
  a.txt                               A       18  Mon Jan  7 16:38:14 2013


smbclient //192.168.18.67/cover -U team01
Password:
Domain=[LOCALHOST] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5.1]
tree connect failed: NT_STATUS_ACCESS_DENIED
smbclient //192.168.18.67/cover -U user1
Password:
session setup failed: NT_STATUS_LOGON_FAILURE

验证二:
smbclient //192.168.18.67/team -U team01
Password:
Domain=[LOCALHOST] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5.1]
smb: \> ls
  .                                   D        0  Mon Jan  7 16:15:26 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013

                35697 blocks of size 524288. 28216 blocks available
smb: \> put a.txt
putting file a.txt as \a.txt (3.5 kb/s) (average 3.5 kb/s)
smb: \> ls
  .                                   D        0  Mon Jan  7 16:41:37 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013
  a.txt                               A       18  Mon Jan  7 16:41:37 2013

                35697 blocks of size 524288. 28216 blocks available

smbclient //192.168.18.67/team -U user01
Password:
Domain=[LOCALHOST] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5.1]
tree connect failed: NT_STATUS_ACCESS_DENIED
[root@biVan ~]# smbclient //192.168.18.67/team -U user01
Password:
Domain=[LOCALHOST] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5.1]
smb: \>  ls
  .                                   D        0  Mon Jan  7 16:41:37 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013
  a.txt                               A       18  Mon Jan  7 16:41:37 2013

                35697 blocks of size 524288. 28216 blocks available
smb: \> put b.txt
NT_STATUS_ACCESS_DENIED opening remote file \b.txt


验证三:smbclient //192.168.18.67/public -U user01
Password:
Domain=[LOCALHOST] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5.1]
smb: \> ls
  .                                   D        0  Mon Jan  7 16:56:27 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013

                35697 blocks of size 524288. 28216 blocks available
smb: \> put a.txt
putting file a.txt as \a.txt (4.4 kb/s) (average 4.4 kb/s)
smb: \> ls
  .                                   D        0  Mon Jan  7 16:56:52 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013
  a.txt                               A       18  Mon Jan  7 16:56:52 2013

                35697 blocks of size 524288. 28216 blocks available
smb: \> rm a.txt
smb: \> ls
  .                                   D        0  Mon Jan  7 16:58:24 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013

                35697 blocks of size 524288. 28216 blocks available
smb: \> put b.txt
putting file b.txt as \b.txt (5.2 kb/s) (average 5.2 kb/s)

smbclient //192.168.18.67/public -U team01
Password:
Domain=[LOCALHOST] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5.1]
smb: \> ls
  .                                   D        0  Mon Jan  7 16:58:55 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013
  b.txt                               A       16  Mon Jan  7 16:58:55 2013

                35697 blocks of size 524288. 28216 blocks available
smb: \> put a.txt
putting file a.txt as \a.txt (5.9 kb/s) (average 5.9 kb/s)
smb: \> ls
  .                                   D        0  Mon Jan  7 16:59:39 2013
  ..                                  D        0  Mon Jan  7 16:15:31 2013
  b.txt                               A       16  Mon Jan  7 16:58:55 2013
  a.txt                               A       18  Mon Jan  7 16:59:39 2013

                35697 blocks of size 524288. 28216 blocks available
smb: \> rm b.txt
NT_STATUS_ACCESS_DENIED deleting remote file \b.txt




 

本文出自 “在路上” 博客,转载请与作者联系!

你可能感兴趣的:(samba,可读写,可读写不可删除其他人的文档)