Skip to content

Instantly share code, notes, and snippets.

@jfautley
Forked from mdengler/gist:3944990
Created October 24, 2012 09:13
Show Gist options
  • Save jfautley/3945009 to your computer and use it in GitHub Desktop.
Save jfautley/3945009 to your computer and use it in GitHub Desktop.
fixperms.sh
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)
echo "Changing user [$UNAME] with home [$HMDIR] to [$USERID:$GRPID]"
#chown -R $USERID:$GRPID $HMDIR
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment