I just did a chmod -x chmod

So I did a chmod -x chmod. How I can fix this problem? How do I give execute rights back to chmod?


In Linux:

/lib/ld-linux.so.2 /bin/chmod +x /bin/chmod

http://www.slideshare.net/cog/chmod-x-chmod


Use python:

# python
Python> import os
Python> os.chmod("/bin/chmod",0755)

This relies on the fact that permissions of a destination file are preserved rather than the source file when it is being copied over. We're "borrowing" the permissions of ls:

cp /bin/ls /tmp/chmod.tmp
cp /bin/chmod /tmp/chmod.tmp
mv /tmp/chmod.tmp /bin/chmod

Using Perl:

% perl -e 'chmod 0755, qw[/bin/chmod]'