I'm "hacking" an ARM-base quadcopter running a stripped down Linux as part of a class assignment, and after getting into it using telnet and getting access to the bash terminal, and then messing around the file system I wanted to see what commands were available and how I could mess with it. I ran "chmod 400 chmod" and now I can't change it back, as when I run "chmod 777 chmod" I get "Permission Denied". Is there a command line fix for this? Or do I need some kind of factory reset to get chmod back? And yes I realized how stupid I am for having done this. Thanks!
If you have perl
, you can do:
perl -e 'chmod(0755, "chmod")'
As suggested here: https://unix.stackexchange.com/questions/77852/how-to-recover-from-a-chmod-r-000-bin you could try using sudo perl -e 'chmod 0755, "/bin/chmod"'
to fix the permissions on the file.
I tried this myself just now by copying /bin/chmod to ~/chmod, running ~/chmod 400 ~/chmod
then attempting to use ~/chmod again. I received a permission denied error as expected. I then used the perl trick such that perl -e 'chmod 0755, "~/chmod"'
and was able to once again use ~/chmod.
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With