Skip to content

Instantly share code, notes, and snippets.

@craigpalermo
Created April 24, 2014 18:51
Show Gist options
  • Save craigpalermo/11265301 to your computer and use it in GitHub Desktop.
Save craigpalermo/11265301 to your computer and use it in GitHub Desktop.
Create home folders for existing Linux users
#grab regular users with user id above 500 from /etc/passwd
awk -F: '$3 > 499' /etc/passwd > uid500+.txt
#extract username, create home directory, and apply home directory to user
for users in `awk -F: '{print $1}' uid500+.txt`
do
mkdir /home/$users
usermod -d /home/$users $users
chown $users:$users /home/$users
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment