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?
A way is to use
multiuser
cifs-mounts andpam_cifscreds
. The Linux login password, and cifs password needs to match in order to use this solution.Using
kerberos
authentication withkeyutils
configured forcifs
and accordingly setuppam
and/orsssd
could also provide passwordless multiuser cifs-mounts.Same as HBruijn I'll say that automount is the solution.
Check http://www.electromech.info/rhce-linux-howtos-electromech-ahemdabad-gujarat/38-automounting-home-directories-with-nis-and-nfs.html
It's not the best source or tutorial I've seen, but i hope this helps.
If the users are in AD and the Windows box is also enrolled in the domain then I suggest adding CentOS boxes to the domain as well and employing kerberos/gssapi for single sign on.
sssd is capable of joining the AD and I am using such a setup myself.