/etc/samba/
The /etc/samba/
directory contains the configuration files for Samba, the suite of programs that allows a Linux system to share files and printers with Windows systems.
Key Files in /etc/samba/
/etc/samba/
smb.conf
secrets.tdb
lmhosts
smb.conf
smb.conf
The primary configuration file for Samba. It controls the behavior of the smbd
and nmbd
services and defines shared resources such as directories and printers.
Key Sections of smb.conf
smb.conf
Global Settings
Share Definitions
Example smb.conf
smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server
netbios name = hostname
security = user
map to guest = bad user
dns proxy = no
[homes]
comment = Home Directories
browseable = no
writable = yes
[public]
path = /srv/samba/public
public = yes
only guest = yes
writable = yes
printable = no
Key Parameters in smb.conf
smb.conf
Global Settings
workgroup
: Defines the Windows workgroup or domain.server string
: Describes the server.netbios name
: The NetBIOS name of the server.security
: The security mode (user
,share
, etc.).map to guest
: How to handle guest users.dns proxy
: Whether to use DNS for NetBIOS name resolution.
Share Definitions
path
: The directory path to be shared.browseable
: Whether the share is visible in network browsers.writable
: Whether the share is writable.public
: Whether the share is accessible without authentication.printable
: Whether the share is a printer.
secrets.tdb
secrets.tdb
This file stores sensitive information, such as user passwords and service credentials. It is maintained by Samba and should not be manually edited.
lmhosts
lmhosts
This file provides a static table for mapping NetBIOS names to IP addresses, similar to /etc/hosts
for DNS.
Example lmhosts
lmhosts
192.168.1.10 server1
192.168.1.20 server2
Managing Samba Configuration
Testing the Configuration
testparm
This command checks the syntax of
smb.conf
and ensures there are no errors.Reloading the Configuration
sudo systemctl reload smbd sudo systemctl reload nmbd
This reloads the configuration without restarting the services.
Summary of /etc/samba/
/etc/samba/
smb.conf
Main configuration file for Samba services
secrets.tdb
Database file for storing sensitive information
lmhosts
Static table for NetBIOS name to IP address mapping
Conclusion
The /etc/samba/
directory is crucial for configuring and managing Samba, enabling file and printer sharing between Linux and Windows systems. Understanding the structure and key files in this directory allows for effective Samba configuration and maintenance.
Last updated