7. How it works

Autodir uses modules to get specific functionality. The core Autodir implements generic functionality on which modules can exploit and add specific functionality of their own.

At any moment only one module can be added to Autodir. If there are two modules, for example autohome, autogroup, two processes of Autodir should be created so that each process will have required modules attached to it.

For further explanation I chose the autohome module which handles transparent home directory creation.


  • autohome module creates user home directories on demand if these does not exist already.

  • It is assumed user accounts exists but not their home directories. Either because these accounts were created with the -M option with useradd or these accounts were imported from ldap, NIS or some other external database for which home directories are yet to be created.

  • It also assumed for this explanation only that all user home directories are expected to be in the /home directory.


Some fine details are intentionally kept aside to make explanation easy to understand.

First autofs file system is mounted on /home directory by Autodir. And this is informed to the Linux kernel that /home is managed by user space application Autodir from now on.

NoteDo not bother too much about autofs file system if you do not understand about it. Just think some special kind of file system something in similarity with memory based file system but with some additional special properties.

                                |  Linux Kernel  |
                                  /        \
                                 /          \
                                /            \
                               /              \
   +-------------+       +--------+       +------------+        +-----------------+
   | Application |------>| /home  |<----->|  Autodir   |<------>| autohome module |
   +-------------+       +--------+       +------------+        +-----------------+
                              \                                          /
                               \  +----------------+                    /
                                +-|   /autohome    |<------------------+

Whenever an application or daemon needs access to user's home directory, for example /home/userhome1, they directly enter into /home/userhome1 to access it. Kernel which notices this, informs to Autodir if userhome1 directory does not exist already in /home.

Autodir, in turn, passes this request to autohome module. autohome module does not touch /home directory. Instead it manages real home directories some where else, for example in /autohome as shown in the above figure.

autohome module creates real home directory if it does not exist already in /autohome directory. After it is successfully created or failed to created, whatever the outcome, it is reported back to Autodir along with the path to real home directory -- if successful.

If autohome module reports success, Autodir creates userhome1 directory under /home and mounts real home directory from /autohome on it. At the end Autodir informs this to the kernel whether this whole operation successful or failure. Accordingly kernel allows application to enter the directory or reports that no such directory exists, in case of failure, back to the application.

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:07