Server Topic
   >  Introduction to Samba
   >  Installing Samba
   >  Samba Daemons
   >  Configuring Samba
   >  Verifying Samba Config
   >  Adding Samba Users
   >  Mapping Client Users
   >  Windows Client Config
   >  Linux Client Config
   >  Troubleshooting Samba

 

Configuring the smb.conf File

Configuring the smb.conf File

Before you can use Samba, you'll need to configure it by customising the smb.conf file. This lives under the /etc/samba folder. As with any system configuration file, it's best to make a backup first, so you can revert to it in the worst case scenario:

$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup

Note: make sure the smbd daemon is not running before editing the configuration file:

$ vi /etc/samba/smb.conf

Once in the editor, alter the "[global]" section so it matches the following:

[global]
    ; General server settings
    netbios name = <1>
    server string = <2>
    workgroup = <3>
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192

    passdb backend = tdbsam (the password database type you are using)
    security = user (this means the client will need to logon with a valid user first)
    null passwords = no(do not allow logons to users with null passwords)
    username map = <4>

    ; setup WINS (-if no WINS, then set "wins support" to "no")
    name resolve order = hosts wins bcast
    wins support = yes

    ; print options (Common Unix Printing System)
    printing = CUPS
    printcap name = CUPS

    ; log messages (warning level1 and above) to the syslog only 
    syslog = 1
    syslog only = yes

    ; tighten up the security to etho and localhost only 
    interfaces = lo, eth0
    bind interfaces only = yes

Where:

  • <1> should be set to whatever the hostname command returns
  • <2> should be set to a descriptive name that will appear in browse lists next to the machine name: %h will print the hostname and %v will print the server version
  • <3> should be set to whatever the Windows "Workgroup" is under the Control Panel -> System -> Computer Name tab
  • <4> [optional] should point to a text file on the server which maps client users to valid users on the server (e.g. maps Windows users to Linux users, if their names are not identical)

Next, append a section at the end of the file, in the following format for each Samba share you require:

[<5>]
    path = <6>
    browseable = yes
    read only = no
    guest ok = no
    create mask = 0644
    directory mask = 0755
    force user = <7>
    force group =<8>

Where:

  • <5> should be set to the name you want the share to be called
  • <6> should be set to the filepath on the local machine that you want to be shared
  • <7> should be set to the username that the Samba user must connect as
  • <8> should be set to the group that the Samba user must connect as


HomeSite IndexDesktop GuideServer GuideHints and TipsHardware CornerVideo SectionContact Us

 sitelock verified Firefox Download Button