If the chmod binary was set to 000, how would you fix it? You can face a problem with /bin/chmod permission denied so you will be not able to apply for permissions. There is a method to recover it by reinstalling coreutils
# ls -ls /bin/chmod 60 -rwxr-xr-x 1 root root 58584 Nov 5 20:46 /bin/chmod # chmod 000 /bin/chmod # ls -ls /bin/chmod 60 ---------- 1 root root 58584 Nov 5 20:46 /bin/chmod # uname -a Linux centos-01 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Jan 18 13:06:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux # rpm --query centos-release centos-release-7-3.1611.el7.centos.x86_64 [root@centos-01 ~]# ls -l total 12 drwxr-xr-x 2 root root 4096 Apr 6 22:54 linox drwxr-xr-x 2 root root 4096 Apr 6 22:54 pac drwxr-xr-x 2 root root 4096 Apr 6 22:54 utils # chmod 640 linox -bash: /usr/bin/chmod: Permission denied # wget http://mirror.centos.org/centos/7/os/x86_64/Packages/coreutils-8.22-18.el7.x86_64.rpm --2017-04-06 23:23:44-- http://mirror.centos.org/centos/7/os/x86_64/Packages/coreutils-8.22-18.el7.x86_64.rpm Resolving mirror.centos.org (mirror.centos.org)... 204.15.73.245, 2604:eb80:1:4::10 Connecting to mirror.centos.org (mirror.centos.org)|204.15.73.245|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 3412144 (3.3M) [application/x-rpm] Saving to: ‘coreutils-8.22-18.el7.x86_64.rpm’ 100%[============================================================================================================>] 3,412,144 4.84MB/s in 0.7s 2017-04-06 23:23:45 (4.84 MB/s) - ‘coreutils-8.22-18.el7.x86_64.rpm’ saved [3412144/3412144] # rpm -Uvh --force coreutils-8.22-18.el7.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:coreutils-8.22-18.el7 ################################# [100%] # ls -ls /bin/chmod 60 -rwxr-xr-x 1 root root 58584 Nov 5 20:46 /bin/chmod # chmod 640 linox # ls -ls total 3348 3336 -rw-r--r-- 1 root root 3412144 Nov 20 17:26 coreutils-8.22-18.el7.x86_64.rpm 4 drw-r----- 2 root root 4096 Apr 6 22:54 linox 4 drwxr-xr-x 2 root root 4096 Apr 6 22:54 pac 4 drwxr-xr-x 2 root root 4096 Apr 6 22:54 utils
0 Comments
Post a Comment