Linux – way to mount a Windows CIFS share and bypass the password prompt without a password file

active-directorylinuxmountwindows

I'm trying to mount a Windows cifs share (shared by Windows) onto a CentOS box, per user. Users are all in Active Directory.

So, every user who logs into their Linux box should be mounting the drive with their own credentials.

A solution I found was to mount using:

mount -t cifs //servername/mylogin /home/mylogin/windows -o uid=mylogin -o gid=groupname -o credentials=/home/mylogin/winpasswd

And for the /home/mylogin/winpasswd:

username=mylogin
domain=domainname
password=password_in_plain_text

However, I don't want to manually implement this for every Linux box and every user on every Linux box. Also, I don't want users having their password in plain text anywhere. Is there a way to mount a Windows cifs share and bypass the password prompt without a password file?

Best Answer

A way is to use multiuser cifs-mounts and pam_cifscreds. The Linux login password, and cifs password needs to match in order to use this solution.

Using kerberos authentication with keyutils configured for cifs and accordingly setup pam and/or sssd could also provide passwordless multiuser cifs-mounts.