old-www/HOWTO/Autodir-HOWTO/homedir.html

568 lines
9.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Managing home directories</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Autodir HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Getting Autodir"
HREF="x422.html"><LINK
REL="NEXT"
TITLE="Managing group directories"
HREF="x559.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Autodir HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x422.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x559.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="homedir"
></A
>18. Managing home directories</H1
><P
>This section will explain how to configure <EM
>Autodir</EM
> so that user home directories are created on demand. For this purpose the <TT
CLASS="literal"
>autohome</TT
> module, which deals with specifics of home directory creation, is used.</P
><P
>To load the <TT
CLASS="literal"
>autohome</TT
> module with <EM
>Autodir</EM
>, use the <TT
CLASS="literal"
>-m</TT
> option. For example, <TT
CLASS="literal"
>-m /usr/lib/autodir/autohome.so</TT
>.</P
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>User/home matching</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>When an application tries to access a home directory, that home directory is used to check if there is any user with the same user name as the directory name being accessed. If a user name exists, then the home directory is created. Otherwise the message <SPAN
CLASS="QUOTE"
>"no such file or directory"</SPAN
> is reported back to the application.</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>User accounts</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
><TT
CLASS="literal"
>Autohome</TT
> does not deal with the creation of user accounts on local systems, in LDAP or in any other database. It only deals with creating home directories once these accounts exist and are imported to the local system from databases like LDAP and NIS.</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="important"
><P
></P
><TABLE
CLASS="important"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/important.gif"
HSPACE="5"
ALT="Important"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Limitations</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>It is worth mentioning one limitation of the <TT
CLASS="literal"
>autohome</TT
> module. It expects that user name and home directory are related to each other. For example, for user <TT
CLASS="literal"
>user1</TT
> the home directory should be <TT
CLASS="filename"
>/home/user1</TT
> or <TT
CLASS="filename"
>/some/directory/name/user1</TT
> but not <TT
CLASS="filename"
>/some/directory/name/userhome1</TT
>. This can be supported but it will be a burden on system resources as each password entry has to be examined from first to last.</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Knowing when not to use autohome</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>If the existing user password database is such that user home directories are distributed under different base directories, for example <TT
CLASS="filename"
>/home/class1/user1</TT
>, <TT
CLASS="filename"
>/home/class2/user2332</TT
>, then <TT
CLASS="literal"
>autohome</TT
> configuration becomes complicated and is not recommended.</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN477"
></A
>18.1. Base directories for autohome</H2
><P
>The next step in the setup procedure is to decide where the <EM
>virtual base directory</EM
> and <EM
>real base directory</EM
> for home directory creation will be located.</P
><P
>What are the <EM
>virtual base directory</EM
> and the <EM
>real base directory</EM
> in the context of the <TT
CLASS="literal"
>autohome</TT
> module?</P
><P
>This all depends on how user accounts are created. If a user account created for user name user1 with home directory <TT
CLASS="filename"
>/home/user1</TT
> then <TT
CLASS="filename"
>/home</TT
> <EM
>will become the virtual base directory</EM
>.</P
><P
>Then what is the <EM
>real base directory</EM
>? This can be any directory. The only thing that you need to keep in mind is that there should be enough space, as all actual files are stored here instead of in the <EM
>virtual base directory</EM
>.</P
><P
>In most server configurations <TT
CLASS="filename"
>/home</TT
> is a separate partition. But if <TT
CLASS="filename"
>/home</TT
> is the <EM
>virtual base directory</EM
>, then files are not stored in that directory! The solution is not to mount a partition on <TT
CLASS="filename"
>/home</TT
> but instead mount it somewhere else and make it the <EM
>real base directory</EM
>.</P
><P
>The <EM
>Autodir</EM
> option <TT
CLASS="literal"
>-d</TT
> is used to specify the <EM
>virtual base directory</EM
>. For example: <TT
CLASS="literal"
>autodir -d /home</TT
> assumes that <TT
CLASS="filename"
>/home</TT
> is the <EM
>virtual base directory</EM
>.</P
><P
>It is somewhat tricky to specify the <EM
>real base directory</EM
>. The <EM
>real base directory</EM
> is managed by the <TT
CLASS="literal"
>autohome</TT
> module so this option must be passed to the module through module suboptions. If the <EM
>real base directory</EM
> is <TT
CLASS="filename"
>/var/autohome</TT
> then it is specified with the option <TT
CLASS="literal"
>-o</TT
> as <TT
CLASS="literal"
>-o realpath=/var/autohome</TT
>.</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN514"
></A
>18.2. Directory organization</H2
><P
>Refer to <A
HREF="dirorg.html"
>directory organization under the real base directory</A
> for a detailed explanation of this topic.</P
><P
><TT
CLASS="literal"
>autohome</TT
> does support this kind of organization. The suboption used to specify the desired directory organization the <TT
CLASS="literal"
>level</TT
> suboption, for instance: <TT
CLASS="literal"
>-o level=2</TT
>.</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN522"
></A
>18.3. Misc suboptions for autohome</H2
><P
>The suboption <TT
CLASS="literal"
>skel</TT
> can be used if the skeleton path is not the default value <TT
CLASS="filename"
>/etc/skel</TT
>: <TT
CLASS="literal"
> -o skel=/some/other/dir</TT
>.</P
><P
>The suboption <TT
CLASS="literal"
>noskel</TT
> can be used with <TT
CLASS="literal"
>-o</TT
> to indicate not to copy any skeleton files to the home directories when these are created.</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN531"
></A
>18.4. Example</H2
><P
>First, import your user accounts from a centralized database, for instance from LDAP.</P
><P
>Next, the <TT
CLASS="literal"
>autofs</TT
> kernel module must be loaded into the Linux kernel. This can be done as described in <A
HREF="autofs_kmod.html"
>autofs kernel module section</A
>.</P
><P
>If <TT
CLASS="filename"
>/home</TT
> is to be used for home directories then <TT
CLASS="filename"
>/home</TT
> will become the <EM
>virtual directory</EM
>; this is specified to <B
CLASS="command"
>autodir</B
> with the <TT
CLASS="literal"
>-d /home</TT
> option.</P
><P
>Assuming that the <TT
CLASS="literal"
>autohome</TT
> module is located in <TT
CLASS="filename"
>/usr/lib/autodir/autohome.so</TT
>, this module can be loaded with <B
CLASS="command"
>autodir</B
> as <TT
CLASS="literal"
>-m /usr/lib/autodir/autohome.so</TT
>. Note that the full path for the module is given.</P
><P
>The actual location of the real home directories is given with the <TT
CLASS="literal"
>realpath</TT
> suboption. If it is <TT
CLASS="filename"
>/autohome</TT
>, the location can be specified as <TT
CLASS="literal"
>realpath=/autohome</TT
>.</P
><P
>With all these options <B
CLASS="command"
>autodir</B
> can be started as:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;# autodir -d /home \
-m /usr/lib/autodir/autohome.so \
-o 'realpath=/autohome' \
</PRE
></FONT
></TD
></TR
></TABLE
><P
>Once <EM
>Autodir</EM
> is started, initially the <TT
CLASS="filename"
>/home</TT
> directory will be empty. Whether <EM
>Autodir</EM
> is working properly can be tested by changing directories to one of the home directories, as the root user or as the owner of the home directory.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x422.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x559.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Getting Autodir</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Managing group directories</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>