Created
October 6, 2016 14:38
-
-
Save tuxpower/87e88f549baaa5e92e93d5af77bf50e9 to your computer and use it in GitHub Desktop.
A bash scripting excercise to fix homedir permissions
This file contains hidden or 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
| #!/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