What happens when you accidently change the permission of the all important ‘chmod’ command?
Let’s try it out….
1. # ls -l /bin/chmod
-rwxr-xr-x. 1 root root
48712 Oct 15 2014 /bin/chmod
2. # rpm -qf `which chmod`
coreutils-8.4-37.el6.x86_64
3. # chmod 444 /bin/chmod
4. # ls -l /bin/chmod
-r--r--r--. 1 root root
48712 Oct 15 2014 /bin/chmod
So, the permission is changed!
5. # chmod 655
/bin/chmod
-bash: /bin/chmod:
Permission denied
Oooops……Screwed !!!!! :(
Now is the time to do
some rescue stuff…
6. Lets restore it
back;
7. # install -m 0755
/bin/chmod ./chmod.tmp
# ./chmod.tmp 0755 /bin/chmod
8. # ls -l /bin/chmod
-rwxr-xr-x. 1 root root 48712 Oct 15 2014 /bin/chmod
Your all important 'chmod' command is back!
Linux just works ! ;)