Monday, August 19

SAMBA Server Configuration in Linux (Redhat or CentOS 6)


    The samba server will provide user authentication via passwords and optionally domains. Samba can also try AFS(andrew file system) authentication, granting AFS rights if successfull or falling back to native password checking otherwise.

        Samba also has the ability through the winbindd daemon, to attach to a microsoft daemon password server.
        When a redhat linux is running  the winbindd service user accounts defined in the microsoft domain can be used to authenticate to the redhat linux machine.
Additionally in samba version 3.0 and later the samba services can use some microsoft active directory resources.

    Four main services of samba
1)Authentication and authorization of users
2)File and printer sharing 
3)Name resolution 
4)Browsing(service announcements)

    smbclient command line access
linux can mount a samba share using cifs and smbfs filesystem 
    File and printer sharing is probably the most attractive samba feature for most users. With this functions users can easily retrive files or print to any printer over the network.

Type: System V-managed service
Packages: Samba,samba-common,samba-client
Daemons: /usr/sbin/nmbd,/usr/sbin/smbd
Script: /etc/init.d/smb
Ports: <netbios> 137(-ns),138(-dgm),139(-ssh),<smb over tcp> 445(-ds)
Configuration file: /etc/samba/smb.conf
Related: system-config-samba,testparm

Steps to configure samba server:
#yum install samba-* -y
#service smb start 
#chkconfig smb on
#vi /etc/samba/smb.conf
copy last 8 lines and paste under change as follows
comment=<any data>
path=/exam(directory to be shared)
valid users=sam john
writable= yes
printable= no
hosts allow= 192.168.0.(allowable network)

here we are sharing /exam directory to sam and john they can read write /exam from any of 192.168.0. network system by using a share name linux
Note: we have to provide samba password for both users 
#smbpasswd -a <username>
samba passwords will store under /etc/samba/smbpasswd
To check syntax of configuration file:
#service smb restart
#mkdir /exam
#chmod 777 /exam
(here we have to set selinux context )
#chcon -t samba_share_t /exam
#setsebool -P allow_smbd_anon_write=1

Note: Client must have samba-client package 
#yum install samba-* -y
#service smb start
#service smb restart
#smbclient //<server IP>/<share name> -U <username>

try to get and put

to disconnect 
smb> (type exit)

from windows client 
Ist method :
right click on mynetwork places--- select mapnetwork drive--- choose a drive
in folderbox type \\<serverip>\sharename
select finish
type username and password 
try to create some files and folders

to disconnect 

rightclick on mynetwork places disconnect network drive 
select drive click ok

IInd Method

start---run ----
provide username and password

to access user homedirectory
#setsebool -P samba_enable_home_dirs 1

from linux client

#smbclient //<serverip>/<myhomes> -U <username>

from windows client
provide username & password

to give directory for a specific group

vi /etc/samba/smb.conf
path=<exported directory>
write list=@<group name>

write list=@sales

No comments:

Post a Comment

:: Linux - Legends ::