Skip to content

Instantly share code, notes, and snippets.

@tuxpower
Created October 6, 2016 14:38
Show Gist options
  • Select an option

  • Save tuxpower/87e88f549baaa5e92e93d5af77bf50e9 to your computer and use it in GitHub Desktop.

Select an option

Save tuxpower/87e88f549baaa5e92e93d5af77bf50e9 to your computer and use it in GitHub Desktop.
A bash scripting excercise to fix homedir permissions
#!/usr/bin/env bash
USERS=$(cat /etc/passwd)
while IFS=: read username password userID groupID gecos homedir usershell
do
if [ "$userID" -ge 1000 ]
then
sudo chown -R "$username". "$homedir"
fi
done < /etc/passwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment