Mount Return Code for CIFS mount

cifsmount

When I run the following command (as root or via sudo) from a bash script I get an exit status (or return code in mount man page parlance) of 1:

mount -v -t cifs //nasbox/volume /tmpdir/ –verbose -o credentials=/root/cifsid &> /tmp/mylog

It outputs the following into the myflog file:

parsing options: rw,credentials=/root/cifsid

mount.cifs kernel mount options unc=//nasbox\volume,ip=192.168.1.1,user=root,pass=xxxx,ver=1,rw,credentials=/root/cifsid

It mounts the volume fine but returns the exit code (from the mount man page):

1 Incorrect invocation or permissions

The standard Linux log files don't contain any error information. Hence, all seems to go well but I get an exit code of 1 instead of 0. Any ideas?

The -v and –verbose options are just there for debugging this problem.

Best Answer

I cannot find anywhere in the source code where it exits with exit code of 1 without printing an error message first.

If you are getting any error messages, you need to add them to your question.

This is probably a bug but I have not been able to find a likely bug report for it.

What operating system are you running, and version of mount.cifs.

EDIT: Can you check the permissions are set so only root can read /root/cifsid as incorrect permissions may be causing this error.