This is the text file allowing you to configure the Samba server.
It is made of different sections whose titles are placed into brackets [ ]. Every line beginning with a ; or a # is ignored at Samba startup. This is often used to add explanation comments on the different sections. Thanks to that, it will be easier later when reading the file again.
During the package install, a /etc/smb.conf file has been copied to your computer. We will use this file as a template.
There are three special sections: [global], [printers], and [homes].
Here, parameters are introduced to apply to the server itself, in its whole, or what will be used as default parameters for some sections.
[global] netbios name = Zeus netbios aliases = creation # without these two entries, the first part of the # DNS name will be used instead. workgroup = DESIGN # Samba can only belong to one work group ar a # time server string = File server [%v] # this indicates the name and the version number to # print deadtime = 15 # maximal inactivity time auto services = queen # this service, although present in the exploration # list, is not available until queen connects to the # server security = user # enable printing with cups printing = cups printcap name = lpstat load printers = yes security = user |
In this mode, the client sends a password while asking for a connection, but no username is required. This mode is the default security mode for files or printers under Windows 95. It may be changed, under Windows 95 in the Network section of the Configuration Panel, under Access Control.
This security mode is recommended. You are asked for a valid username and its associated password.
This mode is derived from user mode. The Samba server sends a session opening request to the passwords server.
password server = NT_passerv # where NT_passerv is the name of the NT passwords # server. Various servers may be listed. |
This mode is almost the same as the previous one.
For these last three modes, the user has to be "created" on the Samba server.
hosts allow = queen.design.org 192.168.2. |
With this line, all users from machine john.design.org and from 192.168.2. network will be allowed to connect.
hosts deny = 192.168.2.5 |
This line deny access from single machine 192.168.2.5. It has the same effect as the EXCEPT statement into hosts allow.
guest account = pcguest # If you wish to add a guest user; to be # added in /etc/passwd |
First of all, create the shared directory with the command mkdir /home/shared and set owners and permissions with chmod and chown. For example, chmod 0777 gives all rights towards this folder on the Unix side. However, Samba has to allow this too.
[share] comment = share access granted to everyone path = /home/shared browsable = yes writable = yes create mask = 0750 # means that the creator of the file has rwx # rights on it, the group r-x and others r-- directory mask = 0750 # same meaning but for directories mangled names = yes # converts names in a DOS/Windows manner, with # eight characters for the name and three for the # extension. preserve case = no # do not take case into account. |
[zip] comment = automatically mount/unmount the zip drive browseable = yes path = /mnt/zip root preexec = /bin/mount /dev/sda4 /mnt/zip root postexec = /bin/unmount /mnt/zip |
It makes the home directory of each user available from a Windows box with their username and password. This is a special sharing type.
[homes] comment = Home directories browseable = no writable = yes path = /export/homes/%U valid users = %S |
This is another special sharing type.
[printers] comment = All Printers browseable = yes printable = yes public = yes writable = no create mode = 0700 print command = lpr-cups -P 0 lpq command = lpstat -o 0 lprm command = cancel 0-%j |
You may also print from GNU/Linux on a printer connected to a PC running Windows. CUPS automatically "views" the shared printers of all Windows machines on your network, simply select it when printing (see "Printing"). Be sure that the printer is set as shareable under Windows.
![]() | Whenever you want to print or serve a printer with your computer, do not forget to install the CUPS package. |
There are a lot of other parameters, for more information, run man smb.conf.
smb.conf sample file:
[global] workgroup = MyWorkGroup server string = (Samba %v) #server string = Samba Server browseable = yes printing = bsd printcap name = /etc/printcap load printers = yes log file = /var/log/samba/log.%m max log size = 100 lock directory = /var/lock/samba locking = no strict locking = no share modes = yes security = user null passwords = yes socket options = TCP_NODELAY # Allows the Samba server to become a domain controller #os level = 33 #domain master = yes # Facilitates the long names recognition preserve case = no short preserve case = no character set = iso8859-1 [homes] comment = Home Directories preexec = /bin/sh -c 'echo /usr/bin/smbclient -M %m -I %I'& browseable = yes readonfiltered= no writable = yes create mode = 0750 public = yes [public] comment = Public path = /public/ browseable = yes hide dot files = yes readonfiltered= no public = yes pritable = yes #create mode = 0775 printable = no [printers] comment = All Printers browseable = yes printable = yes public = yes writable = no create mode = 0700 print command = lpr-cups -P 0 lpq command = lpstat -o 0 lprm command = cancel 0-%j |