linux - chmod 为 root 所有,权限为 220

标签 linux unix file-permissions

如果chmod拥有用户:组权限 root:root ,并拥有 220 的权限、root用户可以恢复执行权限吗?

总的来说,从 Unix 架构的角度来看,这些先有鸡还是先有蛋的问题应该如何解决?

我一直认为,root 用户可以做任何事情,甚至执行 000 的文件。权限。

最佳答案

In general , how those chicken-egg problems should be resolved from Unix architecture perspective?

如果您通过更改 chmod 的权限(无论出于何种原因)而破坏了它,您仍然可以通过调用底层操作系统 Hook 来修复它。例如:

vagrant@vagrant-base-tfisher:~$ sudo -i
root@vagrant-base-tfisher:~# which chmod
/bin/chmod
root@vagrant-base-tfisher:~# chown 220 /bin/chmod 
root@vagrant-base-tfisher:~# ls -la /bin/chmod 
-rwxr-xr-x 1 220 root 51760 Apr  1  2012 /bin/chmod
root@vagrant-base-tfisher:~# chmod 220 /bin/chmod 
root@vagrant-base-tfisher:~# ls -la /bin/chmod 
--w--w---- 1 root root 51760 Apr  1  2012 /bin/chmod
root@vagrant-base-tfisher:~# chmod 755 /bin/chmod 
-bash: /bin/chmod: Permission denied
root@vagrant-base-tfisher:~# irb
irb(main):002:0> File.chmod(0755,'/bin/chmod')                                                                                                                                                              
=> 1
irb(main):003:0> quit
root@vagrant-base-tfisher:~# ls -la /bin/chmod 
-rwxr-xr-x 1 root root 51760 Apr  1  2012 /bin/chmod

关于linux - chmod 为 root 所有,权限为 220,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16239415/

相关文章:

linux - 使用 bash 遍历文件(和目录)名称

目录 : Mercurial - hg merge - "abort: access is denied" 的 Windows 权限

C# Linq for files 用户具有读取权限

linux - 在 bash 函数中,如何将 stdin 放入变量中

linux - 是否可以在不停止被跟踪者的情况下读取线程的指令指针?

linux - 通过 .sh 文件删除文件和文件夹

linux - vlad 部署者 - 使用不同的用户进行部署?

mysql - 为 AES 256 位编译 mysql

linux - 抑制makefile中命令调用的回声?

Bash:如何从数字中提取数字