When it starts up, and with every client request, the Samba daemon reads the configuration file /etc/samba/smb.conf to determine its various modes of operation.
The Samba Configuration File
The /etc/samba/smb.conf file is the main configuration file you'll need to edit. It is split into five major sections,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
You should be aware that your Linux password and Samba passwords are stored in two different locations. This provides the Samba administer the flexibility of allowing only some of the Linux users to have Samba accounts.
Use the passwd command to change Linux passwords, which are stored in the /etc/shadow file. Samba passwords are stored in the /etc/samba/smbpasswd file and can be changed smbpasswd command.
How To Add Users To Your Samba Domain
Adding users to a domain has three broad phases. The first is adding a Linux user on the Samba server, the second is creating a Samba smbpasswd that maps to the new Linux user created previously, and the third is to map a Windows drive letter to the user's Linux home directory. Let's take a closer look:Adding The Users In Linux
First, go through the process of adding users in Linux just as you would normally. Passwords won't be necessary unless you want the users to log in to the Samba server via telnet or ssh.Create the user
To create the user, use the command:useradd -g 100 pankaj
Give them a Linux Password
Giving them a Linux password is only necessary if the user needs to log into the Samba server directly. If the user does, use this method: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
Next, you need to create Samba domain login passwords for the user
/usr/bin/smbpasswd -a username passwordThe -a switch adds the user to the /etc/smbpasswd file. Use a generic password then have users change it immediately from their workstations in the usual way.
Remember the smbpasswd sets the Windows Domain login password for a user, which is different from the Linux login password to log into the Samba box.
By default, Samba automatically gives each user logged into the domain an H: drive that maps to the /home/username directory on the Linux box.
Mapping Using "My Computer"
If the auto-mapping doesn't work then try:- Let the user log into the domain.
- Right-click on the "My Computer" icon on the desktop.
- Click on "Map Network Drive".
- Select a drive letter.
- Browse to the HOMENET domain, then the Samba server, then the user's home directory.
- Click on the check box "Reconnect at Logon", to make the change permanent
Mapping from the Command Line
If you find the "My Computer" method too time consuming for dozens of users or if the PC doesn't have the feature available, then you can use the command-line method and possibly make it into a script.1. Create a master logon batch file for all users
vi /home/samba/netlogon/login.bat2. Add the following lines to mount the user's share as drive P: (for private).
REM Drive Mapping Script net use P: \\server-name\3. Make the file world readable using:
chmod 644 /home/samba/netlogon/login.bat4. Linux and Windows format text files slightly differ. As the file resides on a Linux box, but will be interpreted by a Windows machine, you'll have to convert the file to the Windows format. Use the unix2dos command.
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.
[global] logon script = login.batNow your users will have additional disk space available on a Windows P: drive whenever they login.
Note that this document comes without warranty of any kind. But every effort
has been made to provide the information as accurate as possible. I welcome
emails from any readers with comments, suggestions, and corrections at
webmaster_at admin@linuxhowto.in
Copyright © 2012 LINUXHOWTO.IN
Copyright © 2012 LINUXHOWTO.IN
For sharing printers and shared directory, what should be the entry in smb.conf file. Please give one example....
ReplyDeleteI am having problem in configuring Samba server version 3.0.
ReplyDeleteI 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.
Is iptables running in the samba machine ?
Deletefrom 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.