久久国产乱子伦精品免费M,亚洲一区二区三区91,欧美国产在线视频,国产精品视频久久

chmod 沒有執行權限的解決辦法 [轉載http://www.fblinux.com/?p=30]

chmod沒有權限,貌似就算是root用戶也無法授權,這可咋辦?chmod是設置權限的命令,但是自身沒有了執行權限,那么就表示沒有辦法更改其他命令的權限,也沒有辦法改變自己的權限。

1
2
3
4
[root@localhost ~]# ll /bin/chmod
----------. 1 root root 48712 Oct 15 2014 /bin/chmod
[root@localhost ~]# chmod 755 /bin/chmod
-bash/bin/chmod: Permission denied

解決方法1:

直接運行加載程序,并將其傳遞給想要運行的命令

1
2
3
[root@localhost ~]# /lib64/ld-Linux-x86-64.so.2 /bin/chmod 755 /bin/chmod
[root@localhost ~]# ll /bin/chmod
-rwxr-xr-x. 1 root root 48712 Oct 15 2014 /bin/chmod

加載程序路徑可能不同,32位系統應該是/lib/ld-Linux.so,我沒有測試

解決方法2:

可以使用busybox的chmod授權

1
2
3
[root@localhost ~]# busybox chmod 755 /bin/chmod
[root@localhost ~]# ll /bin/chmod
-rwxr-xr-x. 1 root root 48712 Oct 15 2014 /bin/chmod

解決方法3:

此方法我表示很喜歡

1
2
3
4
5
6
7
8
9
[root@localhost ~]# chmod 000 /bin/chmod
[root@localhost ~]# ll /bin/chmod
----------. 1 root root 48712 Oct 15  2014 /bin/chmod
[root@localhost ~]# mv /bin/chmod /bin/chmod.orig
[root@localhost ~]# cp -a /bin/chown /bin/chmod
[root@localhost ~]# dd if=/bin/chmod.orig of=/bin/chmod
95+1 records in
95+1 records out
48712 bytes (49 kB) copied, 0.00117323 s, 41.5 MB/s

解決方法4:

使用facl額外授權

1
2
3
4
5
6
[root@localhost ~]# chmod 000 /bin/chmod
[root@localhost ~]# ll /bin/chmod
----------. 1 root root 48712 Oct 15 2014 /bin/chmod
[root@localhost ~]# setfacl -m u::rx /bin/chmod
[root@localhost ~]# chmod 755 /bin/chmod
[root@localhost ~]# setfacl -b /bin/chmod

解決方法5:

復制一個可執行文件,然后使用chmod命令覆蓋

1
2
3
4
5
6
7
8
9
[root@localhost ~]# ll /bin/chmod
----------. 1 root root 48712 Oct 15  2014 /bin/chmod
[root@localhost ~]# cp /bin/ls chmod
[root@localhost ~]# cp /bin/chmod .
cp: overwrite `./chmod'? y
[root@localhost ~]# cp -a chmod /bin/chmod
cp: overwrite `/bin/chmod'? y
[root@localhost ~]# ll /bin/chmod
-rwxr-xr-x. 1 root root 48712 May 27 10:23 /bin/chmod

解決方法6:

使用install命令的-m選項也可以設置權限

1
2
3
4
5
6
[root@localhost ~]# ll /bin/chmod
----------. 1 root root 48712 May 27 10:04 /bin/chmod
[root@localhost ~]# install -m a+x /bin/chmod .
[root@localhost ~]# ./chmod 755 /bin/chmod
[root@localhost ~]# ll /bin/chmod
-rwxr-xr-x. 1 root root 48712 May 27 10:04 /bin/chmod

解決方法7:

perl解決

1
2
3
4
5
[root@localhost ~]# ll /bin/chmod
----------. 1 root root 48712 Oct 15 2014 /bin/chmod
[root@localhost ~]# perl -e 'chmod 0755, "/bin/chmod"'
[root@localhost ~]# ll /bin/chmod
-rwxr-xr-x. 1 root root 48712 Oct 15 2014 /bin/chmod

解決方法8:

Python解決

1
2
3
4
5
6
[root@localhost ~]# chmod 000 /bin/chmod
[root@localhost ~]# ll /bin/chmod
----------. 1 root root 48712 Oct 15 2014 /bin/chmod
[root@localhost ~]# Python -c 'import os; os.chmod("/bin/chmod", 0755)'
[root@localhost ~]# ll /bin/chmod
-rwxr-xr-x. 1 root root 48712 Oct 15 2014 /bin/chmod

[轉載http://www.fbLinux.com/?p=30]

相關新聞

歷經多年發展,已成為國內好評如潮的Linux云計算運維、SRE、Devops、網絡安全、云原生、Go、Python開發專業人才培訓機構!

    1. 主站蜘蛛池模板: 建湖县| 都安| 合江县| 陵川县| 邛崃市| 建瓯市| 揭东县| 澄迈县| 桃源县| 扎兰屯市| 宁德市| 大埔区| 邵武市| 措勤县| 淄博市| 赤壁市| 民和| 鄱阳县| 资兴市| 丽江市| 哈巴河县| 河间市| 抚远县| 白沙| 广南县| 利川市| 鹰潭市| 灌南县| 龙泉市| 峨边| 綦江县| 佳木斯市| 华阴市| 乌拉特前旗| 肇州县| 和平县| 浠水县| 泰宁县| 资溪县| 安溪县| 同江市|