Created
April 24, 2014 18:51
-
-
Save craigpalermo/11265301 to your computer and use it in GitHub Desktop.
Create home folders for existing Linux users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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