Create a share folder in CentOS 6.4 and share to Window 7 or other Samba clients

Posted: August 3, 2013 in Linux

Create a share folder in CentOS 6.4 and share to Window 7 or other Samba clients
#Install Samba
yum install samba* -y

#make Guest share Directory
mkdir /samba/guestShare
chmod -R 0777 /samba/guestShare
chcon -t samba_share_t /samba/guestShare

#make Secure share Directory
mkdir /samba/secureShare
chmod -R 0755 /samba/secureShare
chcon -t samba_share_t /samba/secureShare

#Add user for Samba
useradd samba
groupadd smbgroup
usermod -a -G smbgroup samba
smbpasswd -a samba

#Enable Samba from System >> Administration >>Firewall

firewall

# Edit samba configutation File
gedit /etc/samba/smb.conf
# Samba config file created using SWAT
# from UNKNOWN (10.0.0.3)
# Date: 2013/08/03 23:17:56

[global]
workgroup = MYGROUP
server string = Samba Server Version %v
security = SHARE
log file = /var/log/samba/log.%m
max log size = 50
idmap config * : backend = tdb
hosts allow = 127., 192.168.12., 192.168.13., 10.0.0.
cups options = raw
unix charset = UTF-8
dos charset = CP932
[homes]
comment = Home Directories
read only = No
browseable = No

[guestShare]
comment = share for guest
path = /samba/guestShare
writable = yes
browsable = yes
guest ok = yes
guest only = yes
create mode = 0777
directory mode = 0777

[secureShare]
path = /samba/secureShare
read only = yes
writable = no
browsable = yes
create mode = 0755
directory mode = 0755
share modes = yes
valid users = @smbgroup
# Restart Samba Services
/etc/init.d/smb restart
/etc/init.d/nmb restart

# Test Samba Configuration
testparm

 

# Install for Samba GUI mode
yum install xinetd samba-swat -y

# Edit Samba Swat Config
gedit /etc/xinetd.d/swat
# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat \
# to configure your Samba server. To use SWAT, \
# connect to port 901 with your favorite web browser.
service swat
{ port = 901
socket_type = stream
wait = no
only_from = 127.0.0.1 192.168.1.3 10.0.0.3
user = root server = /usr/sbin/swat
log_on_failure += USERID
disable = no
}

# restart Xinetd services
/etc/init.d/xinetd restart

# open samba web GUI
http://server-ip-address:901
http://10.0.0.3:901

sambaGUI

 

Advertisements
Comments
  1. Robert says:

    1st of all I loved this write up. Thanks for taking the time to share it. I have followed your instructions word for word but one step gave me an error. When i used “chcon -t samba_share_t /samba/secureShare” I get “chcon: missing operand. The only changes I made was to name my share “xxxx” instead of secureShare. Any suggestions?

  2. Ing. Pedro Ivan Martinez says:

    tks!! finding for all web and it this the solution!!!

  3. Melvin Candelaria says:

    chcon: can’t apply partial context to unlabeled file `/samba/OfficeShared’

  4. Gonzalo says:

    Centos 5.4 upgrade Centos 6.4 samba copy the files and create a script to create all the users, I work, but I have a problem user folders are empty samba (windows) and see for linux.
    that can not be, I can help.

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