-
-
Save mdengler/3944990 to your computer and use it in GitHub Desktop.
fixperms.sh
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
#!/bin/sh | |
set -e | |
set -x | |
for dir in /home/*; do | |
username=`basename "$dir"` | |
users_group=`id --group $username` | |
chown -R $username:$users_group $username | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awk -F: '($3 >= 1000) { printf("%s:%s:%s:%s\n", $1, $3, $4, $6) }' /etc/passwd | while read line; do
UNAME=$(echo $line | cut -d: -f1)
USERID=$(echo $line | cut -d: -f2)
GRPID=$(echo $line | cut -d: -f3)
HMDIR=$(echo $line | cut -d: -f4)
done