LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

mkhomedir_helper

helper program for the pam_mkhomedir PAM module

TLDR

Create a home directory for a user based on /etc/skel with umask 022
$ sudo mkhomedir_helper [username]
copy
Create a home directory with custom umask (037 = owner all, group read)
$ sudo mkhomedir_helper [username] [037]
copy
Create a home directory based on a custom skeleton directory
$ sudo mkhomedir_helper [username] [umask] [path/to/skeleton_directory]
copy
Create a home directory with specific permissions
$ sudo mkhomedir_helper [username] [umask] [/etc/skel] [0700]
copy

SYNOPSIS

mkhomedir_helper user [umask [path-to-skel [homemode [path-to-vendor-skel_]]]]

DESCRIPTION

mkhomedir_helper is a helper program for the pam_mkhomedir PAM module. It creates home directories and populates them with the contents of the specified skeleton directory.The tool copies files from the skeleton directory (typically /etc/skel) to the new home directory, applying the specified umask to file permissions. It sets ownership to the target user and creates standard configuration files like .bashrc and .profile.The helper is architecturally separated from the PAM module for security reasons, allowing SELinux domain transitions during execution and preventing direct access from login domains to home directory contents.

PARAMETERS

user

Username for which to create the home directory
umask
File creation mask for contents; default is 0022
path-to-skel
Skeleton directory to copy contents from; default is /etc/skel
home_mode
Permissions for the home directory itself; computed from umask if not specified
path-to-vendor-skel
Secondary skeleton directory; when set, home directory is populated from path-to-skel first, then from this directory

INSTALL

sudo apt install libpam-modules-bin
copy
sudo apk add linux-pam
copy
brew install linux-pam
copy
nix profile install nixpkgs#linux-pam
copy

CAVEATS

The tool never modifies existing home directories, preventing accidental overwrites. It requires root privileges to execute. The skeleton directory must exist and be readable. Users must already exist in the system before running this command.

HISTORY

mkhomedir_helper is part of the Linux-PAM (Pluggable Authentication Modules) project. It was designed as a security-conscious helper binary for the pam_mkhomedir module, enabling automatic home directory creation during user login for centrally-managed authentication systems like LDAP.

SEE ALSO

useradd(1), adduser(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid