Monday, January 7, 2008

configuring Samba

Samba is open source implementation of the System Message Block(SMB) service used by Microsoft windows 9x and NT,which is known as CIFS.Samba enables windows client to access Linux file systems and printers by using network Neighborhood facility of the windows manager. SMB is high level protocol built on Microsoft 's NetBIOS protocol,which can be run over TCP/IP network.Samba has 2 associated services:
SMB server acts as the browse master(maintains information on available servers and respond to client discover servers) for a network served by SMB.Linux client can access SMB share in 2 ways:
print tool utility lets us to configure access to Samba printers.

Samba is contain in 3 packages
  • samba-common, which contains files needed by samba clients and servers.
  • samba,which contains the samba server.
  • samba-client,which contains the samba smbclient,smbmount and smbprint.
Samba is in such popular use that many Unix distributions come with it already installed.Samba is already installed on my RHEL 4, I checked the version by using the command:

$ smbd -V
Version 3.0.10-1.4E.2

On Red Hat Linux, I use the rpm command to query the installed packages for Samba:

$ rpm -qa | grep samba
samba-client-3.0.10-1.4E.2
samba-3.0.10-1.4E.2
samba-common-3.0.10-1.4E.2

Administration
the main server administratrion script for samba is /etc/init.d/smb.By invoking this with proper arguments we can control the samba server.

to start samba server:
/etc/init.d/smb start or
service smb start

to restart the samba server:
/etc/init.d/smb restart or
service smb restart

to stop samba server:
/etc/init.d/smb stop or
service smb stop

to check samba status:
/etc/init.d/smb status

Basic server configuration

The main Samba configuration file is /etc/smb.conf, which contains two types of directives:
  1. Global directives, which configure the server.
  2. Service directives, which configure shared files and printers.
Samba Global Directives

The host allow directive identifies the client host permitted to access the server.The localhost address 127.0.0.1,should generally be included in the list of hosts.
#specify the hosts that can access the server
host allow = 192.168.1 192.168.2 127. (partial IP addresses note the trailing dot)

For Windows 9x and NT clients,I specify user as the value of the security parameter.For handling authorization on a per-share basis,value can be specified as share.To handle authorization by primary domain controller(PDC) in another server security value must be specified as server.If the client participate in a domain,value should be domain.
#specify the security is imposed at the user level
security = server

Samba service directives

To create a publicly available share,omit the valid user directive and specify public = yes.
To create access to all members of the group,specify public = @group_name.
To avoid to be in a browse list,specify browseable = no.

Client configuration and use

To access a samba share or a windows 9x/NT share from a linux host:
smbmount //server/share /mount_point

To access a share using smbclient //server/share


Troubleshooting

Testparm tests my configuration file(smb.conf) and report any unknown parameters or incorrect syntax. It also performs a check for common misconfiguration and will issue a warning if one is found.
testparm /etc/samba/smb.conf

To list available shares on the server:
smbclient -L localhost -N

If no shares are visible,the WINS server may not be responding,to investigate that:
nmblookup -B localhost __SAMBA__

to check whether SMB clients are properly configured to use WINS:
nmblookup -d 2 '*'

No comments: