Linux – How to change the directory in wich pam_mkhomedir creates the user’s home directories

home-directorylinuxpam

I am using pam_mkhomedir to automatically create user's home directories when they first log in.

However, the home directories are created inside the /home directory, while i need them to be created inside another one (/users/home).

How can this be achieved ?

Extra info:

  • Editing /etc/default/useradd does not help.
  • The only options that can be passed to pam_mkhomedir are the path to an alternative "skel" directory and a permissions mask.

Best Answer

The homedir should be created in the path for the homedir specified in the users entry in /etc/passwd (or other similar account sources like an LDAP directory). Did you try to change that?

This entry is the authoritative declaration of where the users homedir is (and should be created).