Configure SAMBA server in Linux

Steps to configure SAMBA in LINUX  (Redhat, CentOS, Fedora, etc)

Step1: Install samba(if not installed)
[root@server ~#]yum install samba


Step2: Edit the samba(smb) configuration file /etc/samba/smb.conf
[root@server ~#]vi /etc/samba/smb.conf
#in the 101st line change to “user“
#In this example, i’m sharing a newly created folder “/home/new“, and  is only accessible by  the user james with samba service
#Here “Samba share” is just a sharing name of folder(can change to anything)
# add the following lines  to bottom of the smb.conf
[Samba share]
path = /home/new
writable = yes
createmode = 0770
directory mode = 0770
sharemodes = yes
guest ok = no
valid users = @james


#to control access to samba server, use below method(add to bottom of smb.conf)(optional)
hosts allow = 127.0.0.1 192.168.10.0/24 192.168.50.0/32


#to deny a host, eg:192.168.10.5( use below method)(optional)
hosts deny = 192.168.10.5/32


#to listen samba to custum interfaces( to listen only from eth2)(optional)
interfaces = eth2 lo
# Save the smb.conf file


Note: The home folder of samba user is also shared with samba service


Step3: add the user james and set samba password
[root@server ~#]useradd james
[root@server ~#]smbpasswd -a james
#(now set smaba access password for james)


Step4:Set file permission and group permission to james to access /home/new
[root@server ~#]chgrp james /home/new
[root@server ~#]chmod 2770 /home/new


Step5: Start smaba daemon
[root@server ~#]service smb start
[root@server ~#]chkconfig smb on


Important: Samba server listens on ports 139/tcp and 445/tcp, so you must open these ports in firewall or click to Disable firewall


Step6: to access samba share, run \\<ipaddress> from windows OS
eg: if ip address of samba server is 192.168.10.50, then run this command \\192.168.10.50
You can also share printers with this samba service

2 comments:

Admin said...

Dear Admin,

I have CentOS 6.5 x64 bit server. just install samba server and cofiguration is ok, but ".deleted folder not accessible windows 7" when windows xp, windows server 2003 access.
This Config file...
------------------------------------------------------------------

[global]
server string = Samba %v on (%I)
workgroup = workgroup
hosts allow = 192.168.1.0 192.168.1. 192.168.0. 192.168. 192.168.0.0/16
hosts deny = all except 10.152.82.0 10.152.1. 192.168.1. 192.168.1.0 10.152.0. 10.152. 172.
interfaces = 192.168.0.0/16
log level = 2
log file = /var/log/samba/samba.log.%m
max log size = 1000
debug timestamp = yes
password server = none
security = share
remote announce = 192.168.0.0 192.168.1.0 192.168.0. 192.168.1. 192.168. 192.
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
strict sync = no
sync always = no
syslog = 1
syslog only = yes
max connections = 300
printable = no
;local master = yes
;os level = 33
;domain master = yes
;preferred master = yes
;domain logons = yes
;wins support = yes
create mask = 0777
directory mask = 0777
force directory mode = 0777
Veto files =/*.exe/*.com/*.dll/*.pif/*.cmd/*.inf/*.mp3/*.3gp/*.dat/*.avi/*.msi/*.flv/*.mp4/*.wmv/*.mkv/*.dat/

[datafile]
path = /disk3/datafile
browseable = yes
guest ok = yes
comment = datafile
volume = datafile
writeable = yes
read only = no
vfs object = recycle
recycle:repository = .deleted/%U
recycle:keeptree = Yes
recycle:touch = Yes
recycle:versions = Yes
recycle:maxsixe = 0
recycle:exclude = *.tmp
recycle:exclude_dir = /tmp
recycle:noversions = *.doc
-----------------------------------------------------------------

Unknown said...


Well this is very Good Information for linux learners We Are Also Providing Linux Online Training.Linux Online Training is One of The Best Training Center

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons