Tuesday, October 13, 2009

Samba server configuration

I am writing this as I was doing Samba share configuration between linux and windows machines.

Samba Overview:
1. Uses Session Message Block (SMB) protocol.
2. The most typical reason to use Samba is to allow windows machine and linux machine to interact.
3. Simple to Complex configurations.
4. Easy to manage as there is one main Samba Configuration file /etc/samba/smb.conf

We are going to setup a Linux box so that certain directories and files are shared and we can control how they are shared weather it should be read only or read write. Then from the windows machine we can access that linux share and vice versa. You can also interact between two linux machines using Samba protocol.

Smb.conf layout:
There are 4 special sections in Samba configuration files as given below,

[global] Global Configuration Settings
[homes] Shares users home directories -> Any setting in home section will override the global settings.
[printers] Define shared printer access
[userdefined] This will be a user defined section

Example of a user defined section is as given below,

path = /u01/app/oracle/oradata/orcl <--directory to share
writable = true <--people can write to this directory
valid users = samiora <-- only samiora can access this directory
browsable = yes <-- other users can read this directory but cannot write to it
create mode = 0700 <-- this is chmod for this directory for the owner ie. here it is rwx for the owner.

There are zillion (exaggerating) more parameters used for different settings like require passwords, limit by host, limit by time of day etc.

Login in as root and query if the following rpm's are installed or not if the following packages are not available then firstly install them using rpm command,

#rpm -ivh

[root@egdodb samba]# rpm -qa | grep xinetd

[root@egdodb samba]# rpm -qa | grep samba

Configuring Samba:
You can configure samba by various ways, like manually updating the smb.conf file, using yast utility on suse linux, using SWAT Samba Web Admin Tool and using 'webmin' web based tool. The following is the manual way of updating the smb.conf file,

Update the smb.conf file manually and then run the 'testparm' command to validate the smb.conf file entries,

[root@egdodb samba]# testparm smb.conf

Load smb config files from smb.conf
Processing section "[homes]"
Processing section "[printers]"
Loaded services file OK.
Press enter to see a dump of your service definitions

workgroup = MYGROUP
server string = Samba Server Version %v
passdb backend = tdbsam
cups options = raw

comment = Home Directories
read only = No
browseable = No

comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No

workgroup =

To check the status of samba server service running or not issue the following command,

[root@egdodb samba]# service smb status
smbd is stopped
nmbd is stopped

No comments: