Wednesday, 16 May 2007

What is Samba? -Ashwin

What is Samba?

Samba is an open source software package that mimics a Windows server. Its purpose is to offer an alternative to expensive, unstable Windows servers. Samba can replicate nearly all of Windows server functionality. It appears in the Network Neighborhood like any other Windows machine and functions in the same way. In fact, some servers on your network right now could be running Samba instead of Windows and no one would ever notice.


Samba essentially consists of two or three daemons. A daemon is a UNIX application that runs in the background and provides services. An example of a service is the Apache Web server for which the daemon is called httpd. In the case of Samba there are three daemons, two of which are needed as a minimum.


1. nmbd : Daemon acts as a WINS server service providing DNS-like name-to-IP address translations.

2. smbd : Daemon is the core Samba server service which enables file and printer sharing, network browsing, etc.


winbindd: (3rd Daemon)
This daemon should be started when Samba is a member of a Windows NT4 or ADS domain. It is also needed when Samba has trust relationships with another domain. The winbindd daemon will check the smb.conf file for the presence of the idmap uid and idmap gid parameters. If they are are found, winbindd will use the values specified for for UID and GID allocation. If these parameters are not specified, winbindd will start but it will not be able to allocate UIDs or GIDs.

SAMBA shell script resides in following dir:
/etc/init.d/samba

The main Samba configuration file called smb.conf and is located in this directory:
/etc/smb/samba.conf


Warning: Make sure you backup this file, before making any alterations. Use this command:
cp /etc/samba/smb.conf /etc/samba/org-smb.conf


The smb.conf file supplied with most linux distributions has six sections:

1. [global] - contains many subsections for network-related things such as the domain/workgroup name, WINS, some printing settings, authentication, logging and accounting, etc.
2. [homes] - for file sharing of user home directories
3. [netlogon] - commented out by default, for setting the server to act as a domain controller
4. [printers] - for printer sharing of locally-attached printers
5. [print$] - to set up a share for Windows printer drivers
6. [cdrom] - commented out by default, to optionally share the server's CD-ROM drive


I have only edited following section for my sharing:

[global]
Workgroup = Redhat-SAMBA
Server String = Samba Server
hosts allow = 1.1.1.8
encrpt passwords = yes
smb passwd file = /etc/samba/smbpasswd

[files]
comment = Shared Files
path = /myshare
writeable = yes
Browseable= yes
Valid users=username


Note: I presume , both Windows and Linux box can see/ping each other. Minimum requirement. It is advisable to add the netbios name entry in each other machine.

For Example:
Here is my /etc/samba/lmhosts file
windows machine IP address

And here is my /etc/hosts file:
Linux machine IP address


To configure Samba on your Red Hat Linux system to use encrypted passwords, follow these steps: If someone needs to access a share on your Samba server, they must be both a valid user of the system and a valid Samba user.

Adding Users to a Linux System

To add users to a Linux system, use the following command:

adduser

For example, to add user ashwin to the system, execute the command

adduser ashwin

After adding the user, specify a password for them with the command

passwd

For example to change ashwin password execute

passwd ashwin


Adding Samba Users

To add users to the Samba users list, execute the command

smbpasswd -a

For example, to add ashwin , execute the following

smbpasswd -a ashwin


That's it, now start the SMB service and reload the smb.conf file.

To start smb service:
/etc/rc.d/init.d/smb restart

or

# smb service restart

To reload smb.conf file:
/etc/rc.d/init.d/smb reload

or

# smb service reload


Finaly in Windows Machine:
Open the Windows machine Go to Mynetworkplaces Entire Network Microsoft Windows Network and You should find the "SAMBA" server. You can decide what workgroup name you want to give in the smb.conf file.


Courtesy: Samba: An Alternative to Windows Servers
http://www.mcsr.olemiss.edu/bookshelf/articles/Samba.html
http://samba.org/samba/docs/man/Samba-HOWTO-Collection/install.html

No comments:

Post a Comment