samba

[root@server-rhel6 ~]#yum install -y samba

[root@server-rhel6 ~]#mkdir /sharedrepo

[root@server-rhel6 ~]#groupadd staff

[root@server-rhel6 ~]#chgrp -R staff /sharedrepo/

[root@server-rhel6 ~]#chmod -R 777 /sharedrepo/

[root@server-rhel6 ~]#cd /sharedrepo/

[root@server-rhel6 ~]#touch one

[root@server-rhel6 ~]#chcon -R -t samba_share_t /sharedrepo/

[root@server-rhel6 ~]#semanage fcontext -a -t samba_share_t /sharedrepo/

[root@server-rhel6 ~]#yum provides /usr/sbin/semanage

[root@server-rhel6 ~]#yum install policycoreutils-python

[root@server-rhel6 ~]#setsebool -P samba_enable_home_dirs on

[root@server-rhel6 ~]#useradd test

[root@server-rhel6 ~]#usermod -G staff test

[root@server-rhel6 ~]#smbpasswd -a test

[root@server-rhel6 ~]#vim /etc/samba/smb.conf

[sharedrepo]
comment = shared-directory
path = /sharedrepo
public = no
valid users = test, @staff
writable = yes
browseable = yes
create mask = 0765

interfaces = lo eth0 eth1 172.16.28.0/24
hosts allow = 127. 172.16.28.

[root@server-rhel6 ~]#iptables -I INPUT -p tcp –dport 137 -j ACCEPT

[root@server-rhel6 ~]#iptables -I INPUT -p tcp –dport 138 -j ACCEPT

[root@server-rhel6 ~]#iptables -I INPUT -p tcp –dport 139 -j ACCEPT

[root@server-rhel6 ~]#iptables -I INPUT -p tcp –dport 445 -j ACCEPT

[root@server-rhel6 ~]#service iptables save

[root@server-rhel6 ~]#service iptables reload

[root@server-rhel6 ~]#/etc/init.d/smb start

[root@server-rhel6 ~]#/etc/init.d/nmb start

[root@server-rhel6 ~]#ls -ldZ /sharedrepo/

[root@server-rhel6 ~]#restorecon -R /sharedrepo/

[root@server-rhel6 ~]#restorecon -v /sharedrepo/

[root@server-rhel6 ~]#chkconfig smb on

[root@server-rhel6 ~]#chkconfig nmb on

[root@server-rhel6 ~]#testparm

[root@server-rhel6 ~]# smbstatus

Samba version 3.6.23-24.el6_7
PID     Username      Group         Machine
——————————————————————-
3110      test          test          win-mt62qrou8gk (172.16.28.139)

Service      pid     machine       Connected at
——————————————————-
sharedrepo   3110   win-mt62qrou8gk  Thu Feb 25 11:42:57 2016

Locked files:
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
————————————————————————————————–
3110         501        DENY_NONE  0x100081    RDONLY     NONE             /sharedrepo   .   Thu Feb 25 11:54:11 2016

————————————————
[root@rhel6-client1 ~]# smbclient -L 172.16.28.159 -U test
Enter test’s password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.23-24.el6_7]

Sharename       Type      Comment
———       —-      ——-
sharedrepo      Disk      shared-directory
IPC$            IPC       IPC Service (Samba Server Version 3.6.23-24.el6_7)
test            Disk      Home Directories
HP-LaserJet-P3005CMD$PS,PCL:1 Printer   HP-LaserJet-P3005CMD:PS,PCL
HP-LaserJet-P3005:1 Printer   HP-LaserJet-P3005
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.23-24.el6_7]

Server               Comment
———            ——-
SERVER-RHEL6         Samba Server Version 3.6.23-24.el6_7

Workgroup            Master
———            ——-
MYGROUP              SERVER-RHEL6
[root@rhel6-client1 ~]# smbclient //172.16.28.159/sharedrepo -U test
Enter test’s password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.23-24.el6_7]
smb: \> ls
.                                   D        0  Thu Feb 25 11:11:47 2016
..                                 DR        0  Thu Feb 25 10:57:21 2016
one                                          0  Thu Feb 25 11:11:47 2016

35436 blocks of size 524288. 20246 blocks available

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s