Created
June 25, 2015 20:54
-
-
Save shoaibi/ac894433e774999d7e52 to your computer and use it in GitHub Desktop.
A handy script to generate permissions(modes, user and group) restore scripts for /etc directory.
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/bash | |
# At the start of my DevOps career I used to mess up /etc permissions | |
# a lot so I ended up creating 2 set of scripts that would be generated | |
# on nightly bases using cron and then when required I'd just execute | |
# these scripts | |
find /etc -exec stat --format "chmod %a %n" {} \; > /root/restoreperms.sh | |
find /etc -exec stat --format 'chown %U:%G %n' {} \; > /root/restoreowners.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment