我读过这里,chmod -R 777 /是一个非常糟糕的主意,因为它覆盖了文件的权限,并擦除粘性位和setgid之类的东西。
但是,我认为chmod -R ugo+rwx /不会覆盖这些权限,而是添加它们,如果不是已经存在的话,那么它将比前面的命令安全得多。
我说的对吗?或者这些命令基本上是一样的,两者都会摧毁我的系统吗?
我不打算这样做,只是要求一般的文化。
发布于 2016-07-18 18:08:59
您将从您的系统中删除所有安全性,使其极易受到攻击。由于权限不安全,许多程序将停止运行。在技术上是正确的,它会追加这些权限,而不是过写,这样就可以保留SGID和SUID权限。我有一个旧的Ubuntu机器,我不再需要,所以我想我会测试这个。运行chmod -R ugo+rwx /后,由于/usr/lib/sudo/sudoers.so上的不安全perms,sudo停止工作。ssh停止工作,因为我使用的是rsa键,这也需要严格的权限。我无法在操作系统中重新启动机器,因为sudo坏了,但是电源按钮工作得很好。我很惊讶,因为服务器实际上引导得很好,我可能可以用单用户模式修复它,但我只是要重新安装。所以,为了回答你的问题,不。虽然chmod -R ugo+rwx /在技术上与chmod -R 777 /不同,但它并不安全,因为它们都破坏了您的系统。
发布于 2016-07-18 17:57:56
这些命令并不相同,因为您在符号表示中使用+而不是=,所以您的观察可能是正确的,但最好是查看chmod的手册页。man chmod
.
SETUID AND SETGID BITS
chmod clears the set-group-ID bit of a regular file if the file's group ID does not match
the user's effective group ID or one of the user's supplementary group IDs, unless the
user has appropriate privileges. Additional restrictions may cause the set-user-ID and
set-group-ID bits of MODE or RFILE to be ignored. This behavior depends on the policy
and functionality of the underlying chmod system call. When in doubt, check the underly‐
ing system behavior.
chmod preserves a directory's set-user-ID and set-group-ID bits unless you explicitly
specify otherwise. You can set or clear the bits with symbolic modes like u+s and g-s,
and you can set (but not clear) the bits with a numeric mode.https://unix.stackexchange.com/questions/296675
复制相似问题