AUTH_MKHOMEDIR(3)
β¨ AUTH_MKHOMEDIR β¨
okay bestie, so this is auth_mkhomedir, a page from the authlib corner of the Courier universe, and it's genuinely one of the cutest little functions ever. she does exactly one thing and she does it well: she makes a brand new account's home directory for them π
π¦ NAME π¦
auth_mkhomedir β autocreate a new account's home directory. yes, that's literally it. no cap.
πΈ SYNOPSIS πΈ
#include <courierauth.h>
int rc=auth_mkhomedir(struct authinfo *auth);
π DESCRIPTION π
so here's the vibe. auth_mkhomedir is a callback_func β meaning you pass it as a parameter to auth_getuserinfo_meta(3)[1] β and that callback can call this function to automatically create a new account's home directory. the catch? the authlib client has to be running as root, and you forward the authinfo pointer straight from the callback. slay.
here's what she actually checks, step by step, no skips:
- she checks if the
AUTH_MKHOMEDIR_SKELenvironment variable is set - she checks if the authenticated account's home directory does not exist
if that env var is set, it has to point to a directory β think /etc/skel β that holds a template for what a new account's home directory should contain. it's giving blueprint energy π
now, the important part:
ifAUTH_MKHOMEDIR_SKELis not set, or if the home directory already exists,auth_mkhomedir()does nothing and returns0. she's not doing extra work for nobody. π
otherwise? the account's home directory gets created, and the contents of the AUTH_MKHOMEDIR_SKEL directory get recursively copied into the new home directory. and the details matter here, bestie:
- the permissions of
AUTH_MKHOMEDIR_SKELand everything inside it are preserved - the owner
useridandgroupidget set to the authenticated account'suseridandgroupid
so the template copies over with its vibe intact, but the ownership lands on the right person. iconic. π
π«Ά RETURNS π«Ά
auth_mkhomedir()returns a non-zero value if an error occurred while creating the new account's home directory. π (something went wrong, bestie)auth_mkhomedir()returns zero if the new account's home directory was created successfully β or if the account's home directory already existed. either way, we're good. β¨
π₯ SEE ALSO π₯
π NOTES π
auth_getuserinfo_meta(3)https://www.courier-mta.org/authlib/auth_getuserinfo.htmlauthlib(3)https://www.courier-mta.org/authlib/authlib.html
and that's the whole page, bestie π written by S. Varshavchik, dated 06/18/2026, from the AUTH_MKHOMEDIR(3) manual. go forth and make them home directories. periodt. πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: courier-authlib-dev 0.73.1-2ubuntu1 Β· GPL-3+~with-OpenSSL-exception
- Copyright 2015 S. Varshavchik. See COPYING for -->
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms