Last active
March 23, 2017 20:21
-
-
Save cowens/55ceef8501e5443c0423e63057b83376 to your computer and use it in GitHub Desktop.
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
As root in /: | |
tar cf chmod.tar bin/chmod | |
printf '755' | dd of=chmod.tar bs=1 seek=103 count=3 conv=notrunc | |
printf '013305' | dd of=chmod.tar bs=1 seek=148 count=6 conv=notrunc | |
tar xf chmod.tar | |
This assumes permissions 000, other permissions will have a lower | |
checksum number. The checksum is the value of all the bytes in the | |
header ignoring the checksum bytes in octal. So, if the checksum was | |
013264 (permissions 000) then changing the permissons to 755 will add | |
021 ( 7 + 5 + 5 = 17 = 021) to it resulting in 013305. Likewise, if | |
the permissions were 666, then you would subtract one from the checksum | |
(1 + -1 + -1 = -1). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment