Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Reset Linux Home directory permissions based on /etc/passwd
chown root:root /home
chmod 755 /home
USERS=$(grep '/home' /etc/passwd | tr "\n" "\n")
for USER in $USERS
IFS=":" read -ra DETAILS <<< "$USER"
$(chown -R ${DETAILS[0]}:${DETAILS[0]} ${DETAILS[5]})
$(chmod -R 750 ${DETAILS[5]})

This comment has been minimized.

Copy link
Owner Author

@willpower232 willpower232 commented Dec 13, 2017

If you are using a custom system that has home directories elsewhere, simply substitute /home for your home directories directory (e.g. /organisation/websites)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment