Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to set the PASSWD environment variable like it says you can in the mount.cifs manual, but it still prompts me for a password and ignores the environment variable I set before it.

sudo /bin/mount -t cifs '//servername/share' '/home/users/username/share' --verbose -o user='username',domain=domain,sec=ntlmv2,soft

I forgot to mention. The password contains a ',' which I understand is a delimiter. I think I've misunderstood the cifs manual. Does this mean credentials file is the only way to go?

share|improve this question

Your environment is reset when you use sudo by default. Edit the sudoers file with the visudo command and add the following near the top:

Defaults env_keep += 'PASSWD'

Alternatively you could use something like this:

youruser this_host = SETENV: /bin/mount

See also sudo -E in man 5 sudoers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.