Script to create user's AD home directory

bazzacad

Explorer
Joined
May 1, 2019
Messages
53
I have this shell script I used to run on my Linux file server to create a new user's home directory.

Code:
HOMEDIR="/mnt/share/homes/STA/$1"

if [ -d $HOMEDIR ]; then
    echo "Home directory $HOMEDIR already exists"
else
    echo "Creating home directory $HOMEDIR"
    mkdir $HOMEDIR
fi
echo

echo "Fixing $HOMEDIR ownership and permissions"
chmod -R 0700 $HOMEDIR
chown -R $1:"domain users" $HOMEDIR
echo


But since I can't run chmod or chown from the FreeNAS CLI how do others create new users or work around this?
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,544
If you have the share with the path "/mnt/share/homes" flagged as a 'home' share in the FreeNAS UI, enable "obey pam restrictions". pam_mkhomedir will automatically create the directory when they connect to the share
 

bazzacad

Explorer
Joined
May 1, 2019
Messages
53
Yes, it's set as the home share in the UI.
Do I add that to the Auxiliary Parameters?
How do I pass skel=/path/to/skel/directory to pam_mkhomedir?
 
Top