I have planned to write this post some long time ago, now the time has come to do it.

Basically configuring servers in Linux/*nix include editing of configuration files. Once editing the files if there is any syntax error these service will not start and they will show some wearied errors or just don’t show anything.
For counter attacking this type of issues for each service there will be one or two commands to check for configuration file syntax checking before starting of the service/server, I have collected these commands from my experience and from some of my friends. Please feel free to comment on this if you know some other commands related configuration checkings so that I will update my post.

SSH service: Checking SSH server confiruations for syntax errors in Linux/Unix.

	sshd -t

Example:

	root@linuxnix:/usr/share/nginx/html# sshd -t
Could not load host key: /etc/ssh/ssh_host_ed25519_key
root@linuxnix:/usr/share/nginx/html#

Note1: -t indicates test which is a common options in servers to test configurations.

Note2: Most of these commands are run as root.

FTP service: Checking vsftpd server confiruations for syntax errors in Linux/Unix

	vsftpd

Example:

	root@linuxnix:/usr/share/nginx/html# vsftpd
500 OOPS: could not bind listening IPv4 socket
root@linuxnix:/usr/share/nginx/html#


DHCP server: Checking DHCP server confiruations for syntax errors in Linux/Unix

	dhcpd -t -cf /path/to/dhcpd.conf

Note: -cf is a single options, it’s not -c and -f. And -cf stands for config-file

DNS server: Checking DNS server confiruations for syntax errors in Linux/Unix

Check syntax errors in main configuration file.

	named-checkconf main-config-file
	Example:
named-checkconf named.conf
Syntax OK

Check syntax errors in zone files

	named-checkzone domain-name zonefile-loc
	Example:
named-checkzone example.com /var/named/chroot/var/named/exaple-zone.frd
named-checkzone example.com /var/named/chroot/var/named/exaple-zone.rev

SAMBA server: Checking sAMBA server confiruations for syntax errors in Linux/Unix

	testparm

APACHE server: Checking APACHE server confiruations for syntax errors in Linux/Unix

	httpd -t

For virtual hosts

	httpd -t -D DUMP_VHOSTS

TCP Wrappers: Checking TCP wrappers confiruations for syntax errors

	tcpdchk
tcpdchk -v

Postfox server: Checking POSTFIX server confiruations for syntax errors in Linux/Unix

	postfix check
postfix -vv


LIGHTTPD server: Checking LIGHTTPD server confiruations for syntax errors in Linux/Unix

	lighttpd -t -f /etc/lighttpd/lighttpd.conf

Squid server: Checking SQUID server confiruations for syntax errors in Linux/Unix

Command1:

	squid -k check

Command2:

	squid -k parse

NAGIOS server: Checking NAGIOS server confiruations for syntax errors in Linux/Unix

	/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nginx server: Checking Nginx server confiruations for syntax errors in Linux/Unix

	nginx -t

	service nginx configcheck

Hope you enjoyed this post, please feel free to subscribe to our blog updates.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.