Using testparm to Check Samba Configuration File

Posted on

Folder and file sharing definition in Linux operating system distribution variant can be done using samba utility. Below is a short description on managing that definition of folder and file sharing.

The definition of folder and file sharing can be done as long as the samba service has already been installed. After the samba service successfully installed, it is important to make sure that the service is running and already started.

The samba folder and file sharing definition is configured in a samba file configuration. In most of the operating system it is located in /etc/samba/smb.conf.

As soon as the definition of folder and file sharing definition has created in the samba configuration file before it can be implemented to be accessed, it will be a wise thing to check the configuration defined.

To be able to check whether samba folder and file sharing definition inserted in file /etc/samba/smb.conf is true or false, it can be checked by running tool which is also come together with samba server installation. The tool name is ‘testparm’.

Just run it in the command line in form of any bash prompt available in the operating system as shown below for an example :

testparm

The execution of the tool is shown as follows :

user@soulreaper:~# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

As shown in the above output, the configuration of samba service which is loading the configuration form /etc/samba/smb.conf has already declared as OK. It can be concluded from the line :

Loaded services file OK.

Furthermore, to be able to see details of folder and file definition stated in the samba configuration file type ‘enter’ as instructed in the above output display :

Press enter to see a dump of your service definitions

Below is the output of the samba service definition as ‘enter’ been typed :

# Global parameters
[global]
server string = %h server (Samba, Ubuntu)
server role = standalone server
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
usershare allow guests = Yes
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb
[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers

So, in order to avoid samba service cannot be started or restarted using the samba file configuration which has been edited before, it is quite safe to test it by typing ‘testparm’ to test whether the samba file configuration’s change is valid or not and is suitable to be used for samba to run the service.

One thought on “Using testparm to Check Samba Configuration File

Leave a Reply