> For the complete documentation index, see [llms.txt](https://docs.k9.io/key9-identity/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.k9.io/key9-identity/ssh/installation-and-setup/key9-ssh-for-debian-12-bookworm-howto/8.-automatic-home-directory-creation-optional.md).

# 8. Automatic home directory creation \[optional]

When a user logs into a system for the first time, their directory may not exist. If you want the system to automatically create the user's home directory upon first login, you can use the `pam_mkhomedir.so` PAM (Pluggable Authentication Modules for Linux). This not only creates the user's home directory, but also populates the directory with important files (`.bashrc`, etc), changes the ownership, and sets the home directory permissions.   As "root",  the following command will append the `pam_mkhomedir.so` options to your `/etc/pam.d/common-session`.

`echo "session optional pam_mkhomedir.so" >> /etc/pam.d/common-session`
