I'm trying to convert an autofs setup to systemd for user home dirs through cifs. In essence the problem is to provide the mount command with uid, gid, cruid and UNC per user account when the mount is triggered. The system is integrated with Active Directory for user auth and I use kerberos ticket to authenticate the cifs mount.
In autofs I have a map like this
/adhomes program /etc/auto.adhome --timeout 300
where the /etc/auto.adhome script fetch the neccessary user info from AD with getent and print the following beauty to stdout for autofs to consume
-fstype=cifs,vers=3.0,sec=krb5,file_mode=0700,dir_mode=0700,username=$USERNAME,uid=$uid,gid=$gid,cruid=$uid,domain=$DOMAIN ://${FILESERVER}/${HOMESHARE}/$shortname
The $VARS are computed by the scripts so it returns
-fstype=cifs,vers=3.0,sec=krb5,file_mode=0700,dir_mode=0700,username=abc123@ad.domain,uid=1234567,gid=1234567,cruid=1234567,domain=ad.domain ://fileserver.internal/rhomes/abc123
We have 20000 accounts in our AD so all mappings have to be done on demand. The autofs setup seems to work quite well, but systemd seems to be the way of the future so I'm trying to do the modern approach. Any pointers would be greatly appreciated.
This is on CentOS 8.1.