3

I can successfully mount a windows network drive/share using this command:

mount -t cfis //servername/sharename /mnt -o 'username=user,sec=ntlmssp'

as running this commands prompts a password to be input and then if correct mounts.

According to man mount.cifs I should be able to to this.

mount -t cfis //servername/sharename /mnt -o 'username=user,password=pwd,sec=ntlmssp'

or this

PASSWD='pwd' mount -t cfis //servername/sharename /mnt -o 'username=user,sec=ntlmssp'

However strangely both those commands fail with this message.

 mount error(13): Permission denied

Now because our company does this "supersmart" thing to require passwords with special characters mine does contain a exclamation mark "!". I know that this would have a special meaning to the command line shell, so I have escaped it properly such that if my password was pwd! I would issue those two commands:

PASSWD='pwd\!' mount -t cfis //servername/sharename /mnt -o 'username=user,sec=ntlmssp'

mount -t cfis //servername/sharename /mnt -o 'username=user,password=pwd\!,sec=ntlmssp'

but still it does not work.

Connecting to Windows I do not have any particular feeling of urgency to hide my password (of appearing in the bash history) so I would be happy to find a way to skip the password prompt.

Mostly I would like to know what the problem is?

Lastly I have even tried a credentials file which also did not work.

2 Answers 2

0

You better use a credential file

-o credentials=filename|cred=filename
specifies a file that contains a username and/or password and optionally the name of the  workgroup.
The format of the file is:

username=value
password=value
domain=value
1
  • 2
    The problem remains. 1) Even with credentials file it does not work. I only works if supplied via password prompt. Any idea?
    – fraleone
    Dec 11, 2019 at 15:20
0

You were escaping the exclamation mark when you should not have been doing so. Using single quotes the backslash character remained a literal. Example:

PASSWD='pwd\!'; echo "$PASSWD"    # → pwd\!
PASSWD='pwd!'; echo "$PASSWD"     # → pwd!

Therefore your commands as per your own examples should have been these

PASSWD='pwd!' mount -t cfis //servername/sharename /mnt -o 'username=user,sec=ntlmssp'
mount -t cfis //servername/sharename /mnt -o 'username=user,password=pwd!,sec=ntlmssp'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .