You can easily test your Samba server for configuration errors. It check an smb.conf configuration file for internal correctness.
If this program reports no problems, you can use the configuration file with confidence that smbd will successfully load the configuration file.
Open a shell prompt. And type the following command:
# testparmOR# testparm /etc/samba/smb.conf
The program will issue a message saying whether the configuration file loaded OK or not. This message may be preceded by errors and warnings if the file did not load. If the file was loaded OK, the program then dumps all known service details to screen.
If testparm finds an error in the smb.conf file it returns an exit code of 1 to the calling program, else it returns an exit code of 0. This allows shell scripts to test the output from testparm.
For example:
testparm
if [ $? -eq 0 ]; then
echo "Syntax OK"
else
echo "Syntax Error"
fi
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 4 comments… read them below or add one }
That’s extremely OK!
well when i tried to configure smba – everything went fine … but when clicked on the icon of UNIX SERVER from WIN xp – got an error stating that I do not have access permission and shld contact administartor of that server ..
Doesn’t testparm have to be function? to wrk like that?
function testparm()
{
if [ $? -eq 0 ]; then
echo “Syntax OK”
else
echo “Syntax Error”
fi
}
No. The $? variable stores the value returned by last program executed, in this case, testparm.
Try running any program, including one that quit with errors, and then do an echo $? to see the exit code.