Archive for July, 2006

Parsing smb.conf(Samba Configuration File)

July 5, 2006

Samba’s daemons, smbd and nmbd, are controlled through a single ASCII file : SMB.Conf .

The program must read, parse & edit smb.conf file for configuring( add ,edit or delete)some options like :
-Samba server settings .
-Add shares or edit current share options .

First I introduce the structure of the Samba configuration file and show how to use options to create and modify disk shares &
manage samba server settings.
Global Structure of file:




-[global] section

In this section there are samba server configuration options like these :
*basic settings for the server
–WorkGroup : The workgroup that computer should be in it.
–Description : Brief description of the computer.
They correspond to the workgroup and server string options in smb.conf :
workgroup = MYGROUP
server string = My Samba Server
*Security options :
–security levels :
+user-level security
Each share in the workgroup is configured to allow access from certain users .
+share-level security
Each share in the workgroup has one or more passwords associated with it. Anyone who knows a valid password for the

share can access it.
only user = yes or no
This Boolean option indicates whether Samba will allow connections to a share using share-level security based solely on the individuals specified in the username option, instead of those users compiled on Samba’s internal list.
username = user1 , …
This option presents a list of usernames and/or group names against which Samba tests a connection password to allow access

+server-level security
This is the same as user-level security, except that the Samba server uses another server to validate users and their passwords before granting access to the share.
+domain-level security
+ADS-level security
*Encrypt Passwords

— This option must be enabled if the clients are connecting from a Windows 98, Windows NT 4.0 with Service Pack 3,Windows 2000 or Windows XP . The passwords are transfered between the server and the client in an encrypted format instead of in as a plain-text word that can be intercepted. This corresponds to the encrypted passwords option.

encrypt passwords = yes
*Guest Account

— When users or guest users log into a Samba server, they must be mapped to a valid user on the server. Select one of the existing usernames on the system to be the guest Samba account. When guests logs in to the Samba server, they have the same privileges as this user. This corresponds to the guest account option.
guest account = sambaguest
The [printers] share contains options that map to various printers on the server.
If a user attempts to connect to an ordinary share that doesn’t appear in the smb.conf file , Samba will search for a [homes] share. If one exists, the incoming share name is assumed to be a username and is queried as such in the password database ( /etc/passwd or equivalent) file of the Samba server. If it appears, Samba assumes the client is a Unix user trying to connect to his home directory.

They are individual configuration options for shares on samba server.

-Capitalization is not important in the Samba configuration file except in locations because the Unix filesystem is case-sensitive.
-Line continuation using the backslash at the end of no-finished line.
-Insert comments in the smb.conf configuration file by starting a line with either a hash (#) or a semicolon ( ; ).
& Now a bit about my project :

-These options which users will use and change frequently ,’ubuntu-config-samba’ allow to configure easily in it’s gui environment.
-For Parsing smb.conf file I’ve found ‘redhat-config-samba’ parser to use in my project.

& Now I’m through ‘They was marked 2 Do’ List for completing ‘ubuntu-config-samba’ my SoC Project 😀 …