4

I am trying to setup an automount point using autofs to mount a samba fileshare. I am using the following syntax in my auto.misc file

mydir    -fstype=cifs,rw,user=myusername ://server.domain/path/to/mount

The problem is that it is denying me with NT_STATUS_WRONG_PASSWORD (seen in /var/log/messages with -verbose turned on). It works if I add my password to the mount options using 'password=secretPass123'. I don't want the password to be stored on disk, so I would like it to prompt me for the password. When I mount it manually using "mount" if I leave out the password option, it does prompt me for the password. How do I get autofs to do the same?

I am using CentOS 6.5.

3

I do not think you can have autofs prompt you for a password. You typically have to store it in a credentials file and reference it in automount file. This is how I've dealt with it in the past.

Example

share1     -fstype=cifs,rw,noperm,netbiosname=${HOST},credentials=/etc/credentials.txt ://winserver/share1

This file is then locked down like so:

$ ls -l /etc/credentials.txt 
-rw-------. 1 root root 54 Jun 14 12:29 /etc/credentials.txt

containing this:

username=somdom\user1
password=secret123!

It's not ideal but is the best you can get with autofs. The other approach is to defer mounting to the users themselves and let them do it on demand using gvfs.

You can also use pam_mount which I cover in detail in this U&L Q&A titled: Proper way to mount samba share.

References

  • 1
    I suppose you could make credentials.txt a named pipe and run a password prompting program to feed the pipe. – Gilles Sep 5 '14 at 23:08
  • I was afraid this would be the answer. I was hoping that there was some way to have autofs ask for a password. If I don't get a different answer soon, then I will accept this as the answer. – user1585916 Sep 9 '14 at 15:49
  • There is no support in autofs for it to ask for a password while mounting a share. – fpmurphy Sep 18 '14 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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