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.

1 Answer 1

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

3
  • 1
    I suppose you could make credentials.txt a named pipe and run a password prompting program to feed the pipe. Commented Sep 5, 2014 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. Commented Sep 9, 2014 at 15:49
  • There is no support in autofs for it to ask for a password while mounting a share.
    – fpmurphy
    Commented Sep 18, 2014 at 0:42

You must log in to answer this question.

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