I have a number of existing users in Active Directory that need a home directory created. They don't log directly in to Solaris but into a service running on that box.
If I login as them their home directory gets created and then they can login.
This is the same for new users too!
As there are a lot of users, I need a way to automate this so new users and existing users have it created automatically.
Is this possible??
Unlike Linux, there is no standard pam module like pam_mkhomedir to achieve this task on Solaris. While compiling this pam module would likely just work, there are alternatives like creating the home directory if missing in /etc/profile or setting up an executable auto_home map.
Using /etc/profile to create the user's home directory would require using rbac or sudo so an automounter based solution is simpler to implement, eg:
In the
/etc/auto_master
file, comment out the line:and add this line:
Note: I'm assuming here the previous auto_home map wasn't already used by actual users.
Create the
/opt/local/mkhomedir
script with this content:and that's it. Every user configured to have his home in /home/username will have this directory automatically created at first access if necessary. Of course, you should replace
/tmp/home
by something more persistent in themkhomedir
script, eg/export/home
which is the usual location for home directory back-end storage on Solaris.You have two options:
Use this project
https://github.com/benr/solaris_pam_mkhomedir
You can use the existing SUNWgcc package if you want.
It IS Happening automatically - when a user logs into a computer. Sorry, that is the way MS has designed it.
Best chance you have is logging in via remote desktop on a windows machine (should be scriptable) with a logoff automatic script ;)