HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/usr/share/gtk-doc/html/libuser/libuser-fs.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>fs: libuser Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="libuser Reference Manual">
<link rel="up" href="ch01.html" title="libuser">
<link rel="prev" href="libuser-user.html" title="user">
<link rel="next" href="api-index-full.html" title="API Index">
<meta name="generator" content="GTK-Doc V1.24 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#libuser-fs.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libuser-user.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="api-index-full.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="libuser-fs"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libuser-fs.top_of_page"></a>fs</span></h2>
<p>fs — Utilities for modifying the file system and other
aspects of user/group management.</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libuser-fs.functions"></a><h2>Functions</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libuser-fs.html#lu-homedir-move" title="lu_homedir_move ()">lu_homedir_move</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libuser-fs.html#lu-homedir-populate" title="lu_homedir_populate ()">lu_homedir_populate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libuser-fs.html#lu-homedir-remove" title="lu_homedir_remove ()">lu_homedir_remove</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libuser-fs.html#lu-homedir-remove-for-user" title="lu_homedir_remove_for_user ()">lu_homedir_remove_for_user</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libuser-fs.html#lu-homedir-remove-for-user-if-owned" title="lu_homedir_remove_for_user_if_owned ()">lu_homedir_remove_for_user_if_owned</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libuser-fs.html#lu-mail-spool-create" title="lu_mail_spool_create ()">lu_mail_spool_create</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libuser-fs.html#lu-mail-spool-remove" title="lu_mail_spool_remove ()">lu_mail_spool_remove</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="libuser-fs.html#lu-nscd-flush-cache" title="lu_nscd_flush_cache ()">lu_nscd_flush_cache</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libuser-fs.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libuser-fs.html#LU-NSCD-CACHE-GROUP:CAPS" title="LU_NSCD_CACHE_GROUP">LU_NSCD_CACHE_GROUP</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libuser-fs.html#LU-NSCD-CACHE-PASSWD:CAPS" title="LU_NSCD_CACHE_PASSWD">LU_NSCD_CACHE_PASSWD</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libuser-fs.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;libuser/fs.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="libuser-fs.description"></a><h2>Description</h2>
<p>These routines allow an application to work with home directories, mail
spools and nscd caches.</p>
</div>
<div class="refsect1">
<a name="libuser-fs.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="lu-homedir-move"></a><h3>lu_homedir_move ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
lu_homedir_move (<em class="parameter"><code>const <span class="type">char</span> *oldhome</code></em>,
                 <em class="parameter"><code>const <span class="type">char</span> *newhome</code></em>,
                 <em class="parameter"><code><span class="type">struct lu_error</span> **error</code></em>);</pre>
<p>Moves user's home directory to <em class="parameter"><code>newhome</code></em>
.</p>
<p>Currently implemented by first creating a copy, then deleting the original,
expect this to take a long time.</p>
<p>If you want to use this in a hostile environment, ensure that no untrusted
user has write permission to any parent of <em class="parameter"><code>oldhome</code></em>
 or <em class="parameter"><code>newhome</code></em>
.  Usually
/home is only writable by root, which is safe; user's write permission to
<em class="parameter"><code>oldhome</code></em>
 itself is OK.</p>
<div class="refsect3">
<a name="id-1.2.8.7.2.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>oldhome</p></td>
<td class="parameter_description"><p>Path to the old home directory</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>newhome</p></td>
<td class="parameter_description"><p>Path to the new home directory</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Filled with <a class="link" href="libuser-error.html#lu-error" title="struct lu_error"><span class="type">lu_error</span></a> if an error occurs</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.8.7.2.8"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="lu-homedir-populate"></a><h3>lu_homedir_populate ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
lu_homedir_populate (<em class="parameter"><code><span class="type">struct lu_context</span> *ctx</code></em>,
                     <em class="parameter"><code>const <span class="type">char</span> *skeleton</code></em>,
                     <em class="parameter"><code>const <span class="type">char</span> *directory</code></em>,
                     <em class="parameter"><code><span class="type">uid_t</span> owner</code></em>,
                     <em class="parameter"><code><span class="type">gid_t</span> group</code></em>,
                     <em class="parameter"><code><span class="type">mode_t</span> mode</code></em>,
                     <em class="parameter"><code><span class="type">struct lu_error</span> **error</code></em>);</pre>
<p>Creates a new home directory for an user.</p>
<p>If you want to use this in a hostile environment, ensure that no untrusted
user has write permission to any parent of <em class="parameter"><code>skeleton</code></em>
 or <em class="parameter"><code>directory</code></em>
.  Usually
/home is only writable by root, which is safe.</p>
<div class="refsect3">
<a name="id-1.2.8.7.3.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>ctx</p></td>
<td class="parameter_description"><p>A context</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>skeleton</p></td>
<td class="parameter_description"><p>Path to a "skeleton" directory, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the system default</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>directory</p></td>
<td class="parameter_description"><p>The home directory to populate</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>owner</p></td>
<td class="parameter_description"><p>UID to use for contents of the new home directory</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>group</p></td>
<td class="parameter_description"><p>GID to use for contents of the new home directory that have GID set
to 0 in the skeleton director</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>mode</p></td>
<td class="parameter_description"><p>Mode to use for the top-level directory, also affected by umask</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Filled with <a class="link" href="libuser-error.html#lu-error" title="struct lu_error"><span class="type">lu_error</span></a> if an error occurs</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.8.7.3.7"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="lu-homedir-remove"></a><h3>lu_homedir_remove ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
lu_homedir_remove (<em class="parameter"><code>const <span class="type">char</span> *directory</code></em>,
                   <em class="parameter"><code><span class="type">struct lu_error</span> **error</code></em>);</pre>
<p>Recursively removes a user's home (or really, any) directory.</p>
<p>If you want to use this in a hostile environment, ensure that no untrusted
user has write permission to any parent of <em class="parameter"><code>directory</code></em>
.</p>
<div class="refsect3">
<a name="id-1.2.8.7.4.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>directory</p></td>
<td class="parameter_description"><p>Path to the root of the directory tree</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Filled with <a class="link" href="libuser-error.html#lu-error" title="struct lu_error"><span class="type">lu_error</span></a> if an error occurs</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.8.7.4.7"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="lu-homedir-remove-for-user"></a><h3>lu_homedir_remove_for_user ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
lu_homedir_remove_for_user (<em class="parameter"><code><span class="type">struct lu_ent</span> *ent</code></em>,
                            <em class="parameter"><code><span class="type">struct lu_error</span> **error</code></em>);</pre>
<p>Recursively removes the home directory of user <em class="parameter"><code>ent</code></em>
.</p>
<p>If you want to use this in a hostile environment, ensure that no untrusted
user has write permission to any parent of <em class="parameter"><code>ent</code></em>
's home directory.</p>
<div class="refsect3">
<a name="id-1.2.8.7.5.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>ent</p></td>
<td class="parameter_description"><p>An entity describing the user</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Filled with <a class="link" href="libuser-error.html#lu-error" title="struct lu_error"><span class="type">lu_error</span></a> if an error occurs</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.8.7.5.7"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="lu-homedir-remove-for-user-if-owned"></a><h3>lu_homedir_remove_for_user_if_owned ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
lu_homedir_remove_for_user_if_owned (<em class="parameter"><code><span class="type">struct lu_ent</span> *ent</code></em>,
                                     <em class="parameter"><code><span class="type">struct lu_error</span> **error</code></em>);</pre>
<p>Recursively removes the home directory of user <em class="parameter"><code>ent</code></em>
, only if the directory
is owned by <em class="parameter"><code>ent</code></em>
.  Otherwise fails with <a class="link" href="libuser-error.html#lu-error-homedir-not-owned"><code class="literal">lu_error_homedir_not_owned</code></a>.</p>
<p>If you want to use this in a hostile environment, ensure that no untrusted
user has write permission to any parent of <em class="parameter"><code>ent</code></em>
's home directory.</p>
<div class="refsect3">
<a name="id-1.2.8.7.6.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>ent</p></td>
<td class="parameter_description"><p>An entity describing the user</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Filled with <a class="link" href="libuser-error.html#lu-error" title="struct lu_error"><span class="type">lu_error</span></a> if an error occurs</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.8.7.6.7"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="lu-mail-spool-create"></a><h3>lu_mail_spool_create ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
lu_mail_spool_create (<em class="parameter"><code><span class="type">struct lu_context</span> *ctx</code></em>,
                      <em class="parameter"><code><span class="type">struct lu_ent</span> *ent</code></em>,
                      <em class="parameter"><code><span class="type">struct lu_error</span> **error</code></em>);</pre>
<p>Creates a mail spool for the specified user.</p>
<div class="refsect3">
<a name="id-1.2.8.7.7.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>ctx</p></td>
<td class="parameter_description"><p>A context</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>ent</p></td>
<td class="parameter_description"><p>An entity representing the relevant user</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Filled with <a class="link" href="libuser-error.html#lu-error" title="struct lu_error"><span class="type">lu_error</span></a> if an error occurs</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.8.7.7.6"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="lu-mail-spool-remove"></a><h3>lu_mail_spool_remove ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
lu_mail_spool_remove (<em class="parameter"><code><span class="type">struct lu_context</span> *ctx</code></em>,
                      <em class="parameter"><code><span class="type">struct lu_ent</span> *ent</code></em>,
                      <em class="parameter"><code><span class="type">struct lu_error</span> **error</code></em>);</pre>
<p>Creates a mail spool for the specified user.</p>
<div class="refsect3">
<a name="id-1.2.8.7.8.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>ctx</p></td>
<td class="parameter_description"><p>A context</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>ent</p></td>
<td class="parameter_description"><p>An entity representing the relevant user</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Filled with <a class="link" href="libuser-error.html#lu-error" title="struct lu_error"><span class="type">lu_error</span></a> if an error occurs</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.8.7.8.6"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="lu-nscd-flush-cache"></a><h3>lu_nscd_flush_cache ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
lu_nscd_flush_cache (<em class="parameter"><code>const <span class="type">char</span> *table</code></em>);</pre>
<p>Flushes the specified nscd cache to make the changes performed by other
libuser functions immediately visible.</p>
<div class="refsect3">
<a name="id-1.2.8.7.9.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>table</p></td>
<td class="parameter_description"><p>Name of the relevant nscd table</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="libuser-fs.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="LU-NSCD-CACHE-GROUP:CAPS"></a><h3>LU_NSCD_CACHE_GROUP</h3>
<pre class="programlisting">#define LU_NSCD_CACHE_GROUP "group"
</pre>
<p>Name of the NSCD cache containing group data.</p>
</div>
<hr>
<div class="refsect2">
<a name="LU-NSCD-CACHE-PASSWD:CAPS"></a><h3>LU_NSCD_CACHE_PASSWD</h3>
<pre class="programlisting">#define LU_NSCD_CACHE_PASSWD "passwd"
</pre>
<p>Name of the NSCD cache containing user data.</p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.24</div>
</body>
</html>