Tuesday, February 8, 2011

How To install and test SAMBA

Samba is a suite of utilities that allows your Linux box to share files and other resources, such as printers, with Windows boxes. Samba Domains and Linux share the same usernames so you can log into the Samba based Windows domain using your Linux password and immediately gain access to files in your Linux user's home directory. For added security you can make your Samba and Linux passwords different.

The Samba Configuration File


  File Format - smb.conf

Section Description
[global] General Samba configuration parameters
[printers] Used for configuring printersUsed for configuring printers
[homes] Defines treatment of user logins
[netlogon] A share for storing logon scripts. (Not created by default.)
[profile] A share for storing domain logon information such as "favorites" and desktop icons. (Not created by default.)

Samba Passwords


How To Add Users To Your Samba Domain


Adding The Users In Linux


Create the user

To create the user, use the command:
useradd -g 100 pankaj

Give them a Linux Password

passwd pankaj
Changing password for user pankaj.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.Mapping The Linux Users To An smbpassword

/usr/bin/smbpasswd -a username password

Mapping A Private Windows Drive Share


Mapping Using "My Computer"

If the auto-mapping doesn't work then try:
  1. Let the user log into the domain.
  3. Click on "Map Network Drive".
  4. Select a drive letter.

Mapping from the Command Line

1. Create a master logon batch file for all users
vi /home/samba/netlogon/login.bat
REM Drive Mapping Script
net use P: \\server-name\
3. Make the file world readable using:
chmod 644 /home/samba/netlogon/login.bat
unix2dos /home/samba/netlogon/login.bat
unix2dos: converting file /home/samba/netlogon/login.bat
to DOS format ...
[root@bigboy tmp]#
5. The final step is to edit your smb.conf file's [global] section have a valid entry for the logon script parameter. This can be done using SWAT via the Globals menu.
  logon script = login.bat


Copyright © 2012 LINUXHOWTO.IN


  1. For sharing printers and shared directory, what should be the entry in smb.conf file. Please give one example....

  2. I am having problem in configuring Samba server version 3.0.
    I am trying to configure samba server on rhel 6 with windows 7. But are unsuccessful till now.
    I am getting error.
    Network path was not found .
    Error 0x080070035.
    I have changed the Lan Manager required Authentication. Then also it didn't worked.
    Please help me out.
    Thank you.

    1. Is iptables running in the samba machine ?
      from the XP box try
      telnet 139
      port 139 is samba port and if telnet is successful and you get a blank screen, then there is no problem with iptables. If telnet hangs, then you have to look into eihter adding 139 as trusted port or to stop iptables if the machine is in secure network.