Samba configuration in linux step by step


Step by step installation and configuration

SAMBA include as followed rpm packages.





Download Samba package and installation

[1] Download the binary samba rpm package

[2] Use command rpm to install these packages

#rpm -ihv *.rpm

Preparing… ########################################### [100%]

Configuration for file sharing

Samba’s configuration is stored in the smb.conf file, which usually resides in /etc/samba/smb.conf .

smb.conf example


workgroup = mygroup

log file = /var/log/samba/%m.log

max log size = 500

encrypt passwords = yes


comment = Home Directories

browseable = no

read only = no


path = /data/mp3

public = yes

read only = yes

write list = @laaos

smb.conf parameters

Configuring global variables

[Global Parameters]

workgroup = mygroup : this is the name of your network group. It is important that both Samba and Windows are in the same workgroup. Please read your Windows documentation on how to change your Windows pc’s workgroup name.

encrypt passwords = yes: Samba can work with encrypted or unencrypted passwords. However, Windows 98, Windows NT, and Windows 2000 utilize encrypted passwords. The only time that this should be set to no is when you have any older Windows systems running on your network ie: Windows 95, Windows 3.x. If this is the case you will have to do some registery modifications to your Windows 98, NT, 2000 to allow them to send unencrypted passwords across the network. Not the most secure situation though.

Configuring Share variables

[Share Parameters]


comment = Home Directories

browseable = no

read only = no

[homes] When you create a user on your Linux pc it will automatically create a home folder for you in /home/yourusername. Think of this as your “My Documents” for Linux.

read only = no: By default Samba will always make any directory read only for security reasons, so we need to let Samba know that we want to be able to write to this directory.

browseable = no: defines when you map a network drive to Samba, it will map directly to your user directory ie: \\home\laaos (this is my username on Linux and Samba) This share /home/laaos is browseable only by you. Remember this is much the same as the “My Documents” folder in Windows


path = /data/mp3

public = yes

browseable = yes

read only = yes

write list = @laaos

[Music] This will create a share for mp3 storage. Again lets go over the share parameters for this.

path = /data/mp3: This tells us the directory is found on the Samba server as /data/mp3, later when we map the network drive on the Windows pc, it will be seen as “Music” in Network Neighborhood

browseable = yes: This share will show in in Network Neighborhood as “Music”

public = yes: Specifies anyone can access and view the contents of /data/mp3

write list = laaos:

Although anyone can view and excute (meaning see and play any mp3 in this directory). For security and practical reasons I have set this share so that only laaos can delete or add files. You can add as many names as you wish to this line ie:, rudy etc. To exclude any person from being able to access this share altogether, add the line: invalid users = nick, sleuth. These names are the logon names from Windows, and are not case sensitive. They also must have a logon name and Samba password on the Linux pc.

In order for Samba to accomplish all this we need to set certain Linux file permissions such as these. This can be done by opening your file manager (in this case Konqueror) and right clicking on the /data/mp3 share and choosing properties

Samba Service management

Adding Users and Restarting Samba


1. adduser laaos

useradd -d /home/laaos laaos

2. init laaos’s password

passwd laaos

3. init laaos’s smbpasswd

smbpasswd -a laaos

4. /etc/init.d/smb restart

Samba Issue diagnosis

diagnostic tools

To verify that the parameters are correct in the smb.conf file or to debug configuration problems, use the testparm command.


For debugging problems with Samba in general, the log files log.smbd and log.nmbd under the /var/log/samba directory are invaluable.

The parameter log level in the global section of the smb.conf file determines the amount of detailed information Samba writes to the log files, with level 0 being the most general and 10 being the most detailed. Each logging level contains the messages from that level, in addition to the logging messages below it. For example, a logging level of 5 contains messages from level 5, plus those from levels 0 through 4.

# this tells Samba to use a separate log file for each machine

# that connects

log file = /var/log/samba/%m.log

debuglevel = 4

For more info you can check “man samba”

In case of any ┬ęCopyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.