Solved: Error on Linux -bash: /usr/bin/chmod: Permission denied.

Today we will look how to solve below error on our linux system.

-bash: /bin/chmod: Permission denied

 

I. Issue
Lets see how to replicate the issue on our Linux System.

### Create a file
[root@nglinux ]# touch testfile
[root@nglinux ]# chmod 000 testfile
[root@nglinux ]# ls -ltr testfile
total 16
----------. 1 root root   81 May  8 14:35 testfile

### Change the permissions of chmod
[root@nglinux ]# chmod 000 /bin/chmod 

### Now try to change the permissions.
### It will generate below error.
[root@nglinux ]# chmod 644 testfile 
-bash: /bin/chmod: Permission denied
[root@nglinux ]# 

 

II. Solution

[root@nglinux ]# yum reinstall coreutils
Failed to set locale, defaulting to C
Loaded plugins: auto-update-debuginfo, fastestmirror, refresh-packagekit, security
Setting up Reinstall Process
Loading mirror speeds from cached hostfile
 * base: mirror.hostduplex.com
 * epel: mirror.layeronline.com
 * epel-debuginfo: mirror.layeronline.com
 * epel64: mirror.layeronline.com
 * extras: mirror.sjc02.svwh.net
 * updates: mirror.sjc02.svwh.net
Resolving Dependencies
--> Running transaction check
---> Package coreutils.i686 0:8.4-47.el6 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================================================
 Package                                                             Arch                                                           Version                                                              Repository                                                      Size
==============================================================================================================================================================================================================================================================================
Reinstalling:
 coreutils                                                           i686                                                           8.4-47.el6                                                           base                                                           3.0 M

Transaction Summary
==============================================================================================================================================================================================================================================================================
Reinstall     1 Package(s)

Total size: 3.0 M
Installed size: 12 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : coreutils-8.4-47.el6.i686                                                                                                                                                                                                                                  1/1 
  Verifying  : coreutils-8.4-47.el6.i686                                                                                                                                                                                                                                  1/1 

Installed:
  coreutils.i686 0:8.4-47.el6                                                                                                                                                                                                                                                 

Complete!
[root@nglinux ]# 

### Now try to change the permissions
### And its successful.
[root@nglinux ]# chmod 644 testfile 
[root@nglinux ]# ls -l testfile 
-rw-r--r--. 1 root root 81 May  8 14:35 testfile
[root@nglinux ]# 

Leave a Reply

avatar
  Subscribe  
Notify of