Wednesday, July 17, 2013

Configure SAMBA Server in RHEL6





Samba
Samba, which uses the CIFS/SMB protocol, is commonly brought up when you want Linux and Windows machines to be able to share files together.


Step 1. Install the required packages for Samba:
# yum install –y samba samba-common samba-client

Step 2. You need to edit the main config file to set up the Samba server
and directories that you’d like to make into Samba shares.

#vim /etc/samba/smb.conf

### Samba Share for Company Data ###
[company_data]

### Define a comment for the share ###
comment = Directory for all employees within the company

### Allow users to access the share and define its location ###
browseable = yes
path = /opt/company_data

### Make the share writable and define access for valid users ###
valid users = kamal
writable = yes

Step 3. Save the file and exit.

Step 4. Check the syntax of the config file:

# testparm
Load smb config files from /etc/samba/smb.conf
Processing section “[company_data]”
Loaded services file OK.

[company_data]
comment = Directory for all employees within the company
path = /opt/company_data
valid users = kamal
read only = No

Create your first Samba user and enable it.
# smbpasswd -a kamal
New SMB password:
Retype new SMB password:
Added user kamal.

# smbpasswd -e kamal


Step 5. If you haven’t done so already, start the Samba service:
# service smb start
Starting SMB services: [ OK ]

Step 6. SELinux and Firewall Configuration
If you are accustomed to Windows systems, you should already know what ports
you need to open on the firewall.

# iptables -I INPUT  -p tcp -m tcp --dport 137 -j ACCEPT
# iptables -I INPUT  -p udp -m udp --dport 138 -j ACCEPT
# iptables -I INPUT  -p udp -m udp --dport 139 -j ACCEPT
# iptables -I INPUT  -p tcp -m tcp --dport 445 -j ACCEPT

# service iptables save

# service iptables restart

# service smb restart

now go on windows system and open run then type \\sambaserverip

it will ask for user/password type and enjoy?????

No comments:

Post a Comment