# 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`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.k9.io/key9-identity/ssh/installation-and-setup/key9-ssh-for-debian-12-bookworm-howto/8.-automatic-home-directory-creation-optional.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
