from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Revision as of 21:42, 10 September 2010 by Woozle (talk | contribs) (→‎Parameters: list complete -- saving for now. Reformat later.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


computing: software: Samba: smb.conf


smb.conf is the main configuration file for the Samba server, which provides Windows "Network Neighborhood" shares on Linux (and possibly on other non-Windows operating systems).





see /printers



These parameters are aliases for other parameters. Use the real name where possible.


Starting with Samba version 3.0.23 the capability for non−root users to add, modify, and delete their own share definitions has been added. This capability is called usershares and is controlled by a set of parameters in the [global] section of the smb.conf. The relevant parameters are :

  • usershare allow guests - Controls if usershares can permit guest access.
  • usershare max shares - Maximum number of user defined shares allowed.
  • usershare owner only - If set only directories owned by the sharing user can be shared.
  • usershare path - Points to the directory containing the user defined share definitions. The filesystem permissions on this directory control who can create user defined shares.
  • usershare prefix allow list - Comma−separated list of absolute pathnames: only directories below the pathnames in this list are permitted.
  • usershare prefix deny list - Comma−separated list of absolute pathnames: directories below the pathnames in this list are prohibited.
  • usershare template share - Names a pre-existing share used as a template for creating new usershares. All other share parameters not specified in the user defined share definition are copied from this named share.

variable substitutions

Many of the strings that are settable in the config file can take substitutions. For example the option "path = /tmp/%u" is interpreted as "path = /tmp/john" if the user connected with the username john.

These substitutions are mostly noted in the descriptions below, but there are some general substitutions which apply whenever they might be relevant. These are:

  • %U - session username (the username that the client wanted, not necessarily the same as the one they got).
  • %G - primary group name of %U.
  • %h - the Internet hostname that Samba is running on.
  • %m - the NetBIOS name of the client machine (very useful).
    This parameter is not available when Samba listens on port 445, as clients no longer send this information. If you use this macro in an include statement on a domain that has a Samba domain controller be sure to set in the [global] section smb ports = 139. This will cause Samba to not listen on port 445 and will permit include functionality to function as it did with Samba 2.x.
  • %L - the NetBIOS name of the server. This allows you to change your config based on what the client calls you. Your server can have a "dual personality".
  • %M - the Internet name of the client machine.
  • %R - the selected protocol level after protocol negotiation. It can be one of CORE, COREPLUS, LANMAN1, LANMAN2 or NT1.
  • %d - the process id of the current server process.
  • %a - The architecture of the remote machine. It currently recognizes Samba (Samba), the Linux CIFS file system (CIFSFS), OS/2, (OS2), Windows for Workgroups (WfWg), Windows 9x/ME (Win95), Windows NT (WinNT), Windows 2000 (Win2K), Windows XP (WinXP), Windows XP 64-bit (WinXP64), Windows 2003 including 2003R2 (Win2K3), and Windows Vista (Vista). Anything else will be known as UNKNOWN.
  • %I - the IP address of the client machine.
  • %i - the local IP address to which a client connected.
  • %T - the current date and time.
  • %D - name of the domain or workgroup of the current user.
  • %w - the winbind separator.
  • %$(envvar) - the value of the environment variable envar.

The following substitutes apply only to some configuration options (only those that are used when a connection has been established):

  • %S - the name of the current service, if any.
  • %P - the root directory of the current service, if any.
  • %u - username of the current service, if any.
  • %g - primary group name of %u.
  • %H - the home directory of the user given by %u.
  • %N - the name of your NIS home directory server. This is obtained from your NIS entry. If you have not compiled Samba with the --with-automount option, this value will be the same as %L.
  • %p - the path of the service´s home directory, obtained from your NIS entry. The NIS entry is split up as %N:%p.

There are some quite creative things that can be done with these substitutions and other smb.conf options.