Created
May 10, 2019 00:37
-
-
Save kirrie/3d17363b1533b62641d43842d9baf1ed to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
sysdirs=" | |
/bin | |
/etc | |
/lib | |
/sbin | |
/usr | |
" | |
# Remove world-writable permissions. | |
# This breaks apps that need to write to /tmp, | |
# such as ssh-agent. | |
find / -xdev -type d -perm +0002 -exec chmod o-w {} + | |
find / -xdev -type f -perm +0002 -exec chmod o-w {} + | |
# Ensure system dirs are owned by root and not writable by anybody else. | |
find $sysdirs -xdev -type d \ | |
-exec chown root:root {} \; \ | |
-exec chmod 0755 {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment