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?

link|improve this question

20% accept rate
feedback

1 Answer

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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