samba

安装

[root@localhost ~]# yum install samba samba-client samba-swat
[root@localhost ~]# rpm -qa |grep samba
samba-swat-3.5.10-125.el6.x86_64
samba-client-3.5.10-125.el6.x86_64
samba-3.5.10-125.el6.x86_64
samba-common-3.5.10-125.el6.x86_64
samba-winbind-clients-3.5.10-125.el6.x86_64

设置所有人可访问public目录

[root@localhost ~]# cd /etc/smamba/
[root@localhost samba]# ls
lmhosts  smb.conf  smbusers
[root@localhost samba]# cp sm b.conf smb.conf.bak
[root@localhost samba]# vim smb.conf
#======================= Global Settings =====================================
        security = share
        client lanman auth = yes
#============================ Share Definitions ==============================
[public]
        comment = Public Stuff
        path = /share
        guest ok = yes
        writable = yes
[root@localhost samba]# cd /
[root@localhost /]# cd /opt/
[root@localhost opt]# mkdir share
[root@localhost opt]# cd share/
[root@localhost share]# touch samba.txt ccc111.txt bb1.txt
[root@localhost share]# ls
aa.txt  samba.txt
[root@localhost share]# cd ..
root@localhost opt]# cd chown -R nobody:nobody share/
root@localhost opt]# ll
drwxr-xr-x  2 nobody nobody 4096 Sep 25 15:50 share
[root@localhost opt]# service smb restart;
[root@localhost ROOT]# service iptables status
iptables: Firewall is not running.
[root@localhost ROOT]# getenforce
Disabled
[root@localhost ROOT]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[public]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = MYGROUP
        server string = Samba Server Version %v
        security = SHARE
        client lanman auth = Yes
        log file = /var/log/samba/log.%m
        max log size = 50
        smb ports = 139
        cups options = raw

[public]
        comment = Public Stuff
        path = /opt/share
        read only = No
        guest ok = Yes               
[root@localhost ROOT]# smbclient //localhost/public
Enter root's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
Server not using user level security and no password supplied.
smb: \> ls
  .                                   D        0  Mon Oct 12 16:36:11 2015
  ..                                  D        0  Fri Oct  9 15:56:56 2015
  ccc111.txt                          A       11  Tue Sep 29 10:26:30 2015
  samba.txt                           A       12  Mon Oct 12 16:36:15 2015
  bb1.txt                             A        6  Tue Sep 29 14:23:56 2015

                36942 blocks of size 4194304. 21347 blocks available
smb: \>
smb: \> exit


设置ts目录,只能ts用户组查看,且只能组中dog能修改,horse不能修改

[root@localhost ROOT]# groupadd ts
[root@localhost ROOT]# useradd -g ts dog
[root@localhost ROOT]# useradd -g ts horse
[root@localhost ROOT]# smbpasswd -a dog
[root@localhost ROOT]# smbpasswd -a horse

[root@localhost samba]# vim smb.conf
#======================= Global Settings =====================================
        security = user
        client lanman auth = yes
#============================ Share Definitions ==============================
[ts]
        comment = TS
        path = /ts
        valid users = @ts
        write list = dog

[root@localhost ROOT]# mkdir /opt/ts
[root@localhost ROOT]# cd /opt/ts
[root@localhost ts]# touch 345333444222.txt horse.txt 456789.txt 111222.a
[root@localhost ROOT]# chown dog:ts ts

[root@localhost ROOT]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[public]"
Processing section "[ts]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = MYGROUP
        server string = Samba Server Version %v
        client lanman auth = Yes
        log file = /var/log/samba/log.%m
        max log size = 50
        smb ports = 139
        cups options = raw

[public]
        comment = Public Stuff
        path = /opt/share
        read only = No
        guest ok = Yes

[ts]
        comment = TS
        path = /opt/ts
        valid users = @ts
        write list = dog

[root@localhost ROOT]# smbclient //localhost/public
Enter root's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
Server not using user level security and no password supplied.
smb: \> ls
  .                                   D        0  Mon Oct 12 16:36:11 2015
  ..                                  D        0  Fri Oct  9 15:56:56 2015
  ccc111.txt                          A       11  Tue Sep 29 10:26:30 2015
  samba.txt                           A       12  Mon Oct 12 16:36:15 2015
  bb1.txt                             A        6  Tue Sep 29 14:23:56 2015

                36942 blocks of size 4194304. 21347 blocks available



[root@localhost ROOT]# smbclient //localhost/ts -U horse
Enter horse's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
smb: \> ls
  .                                   D        0  Fri Oct  9 17:27:26 2015
  ..                                  D        0  Fri Oct  9 15:56:56 2015
  345333444222.txt                            10  Fri Oct  9 17:27:28 2015
  111222.a                                     0  Fri Sep 25 17:20:22 2015
  456789.txt                          A        0  Fri Oct  9 15:40:47 2015

                36942 blocks of size 4194304. 21347 blocks available
smb: \> help
?              allinfo        altname        archive        blocksize
cancel         case_sensitive cd             chmod          chown
close          del            dir            du             echo
exit           get            getfacl        hardlink       help
history        iosize         lcd            link           lock
lowercase      ls             l              mask           md
mget           mkdir          more           mput           newer
open           posix          posix_encrypt  posix_open     posix_mkdir
posix_rmdir    posix_unlink   print          prompt         put
pwd            q              queue          quit           readlink
rd             recurse        reget          rename         reput
rm             rmdir          showacls       setmode        stat
symlink        tar            tarmode        translate      unlock
volume         vuid           wdel           logon          listconnect
showconnect    ..             !
smb: \> mkdir horse.txt
NT_STATUS_MEDIA_WRITE_PROTECTED making remote directory \horse.txt
smb: \> exit
[root@localhost ROOT]# smbclient //localhost/ts -U dog
Enter dog's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
smb: \> mkdir horse.txt
smb: \> ls
  .                                   D        0  Mon Oct 12 16:52:58 2015
  ..                                  D        0  Fri Oct  9 15:56:56 2015
  345333444222.txt                            10  Fri Oct  9 17:27:28 2015
  horse.txt                           D        0  Mon Oct 12 16:52:58 2015
  111222.a                                     0  Fri Sep 25 17:20:22 2015
  456789.txt                          A        0  Fri Oct  9 15:40:47 2015

                36942 blocks of size 4194304. 21347 blocks available
smb: \>


在windows下添加samba路径


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值