我只是做了一个chmod -x chmod

所以我做了一个chmod -x chmod 。 我如何解决这个问题? 我如何将执行权返回给chmod?

在Linux中:

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

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

使用python:

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

这依赖于目标文件的权限在被复制时被保留而不是源文件的事实。 我们正在“借” ls的权限:

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

使用Perl:

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

这很奇怪…几天前我通过某人的推特看到了类似这样的事情…

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

setfacl -mu::rx /bin/chmod

…将授予所有者执行权限。

但是,/ /lib/ld-linux.so.2技巧是整洁的。 🙂

如果你在一个系统中/bin/chmod不能被dynamic链接器加载:

 # /bin/mv /bin/chmod /bin/chmod.tmp # install -p -m 755 /bin/chmod.tmp /bin/chmod 

这适用于我的MacOS X系统。

/ rescue / chmod 555 / bin / chmod

我想你也可以使用mtree。

创build一个新的chmod并将其用于原始

 umask 000 cat chmod > ~/my-chmod ~/my-chmod a+x chmod 

我怀疑这不是一个真正的问题: http : //www.slideshare.net/cog/chmod-x-chmod

  • 重新安装chown:sudo apt-get install –reinstall coreutils
  • perl -e'chmod 0755,“chmod”'
  • 幻灯片中有更多的例子