Test your Samba server for configuration errors

by Vivek Gite on September 28, 2006 · 3 comments

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

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

{ 3 comments… read them below or add one }

1 ken July 5, 2007

That’s extremely OK!

Reply

2 oes tsetnoc September 28, 2009

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 ..

Reply

3 stainless December 24, 2011

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
}

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 10 + 11 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: