设置linux权限允许写入现有文件,但不允许创建新文件
是否有递归 chmod 命令允许编辑现有文件,但不允许创建新文件或目录?我有一个托管用户,他的网站不断被黑客攻击以托管网络钓鱼网站。当他致力于修复代码中的漏洞时,我想 chmod 他的整个主目录,这样就无法创建新文件,但他仍然可以更新现有代码来修复漏洞。
Is there a recursive chmod command that would allow editing of existing files, but not creation of new files or directories? I have a hosting user who has a website that keeps getting hacked to host a phishing site. While he works on closing the hole in his code, I'd like to chmod his whole home directory so no new files can be created, but he can still update the existing code to fix the hole.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目录的权限控制您是否可以列出(读取)、创建(写入)或查找(执行)该目录中的文件。创建文件后,文件所有权和权限将控制您访问该文件的方式。所以您应该能够
chmod aw
目录。不过,他无法重新创建文件,只能修改它们。不过,任何黑客都可以逆转该更改,除非您也剥夺了他的目录所有权。在这种情况下,您根本不必更改写入权限。Permissions on the directories control whether you can list (read), create (write) or look up (execute) files in that directory. Once a file is created the file ownership and permissions control how you can access that file. So you should be able to
chmod a-w
the directories. He won't be able to re-create files, though, only modify them. Any hacker could reverse the change, though, unless you also take directory ownership away from him. In which case you wouldn't have to change the write perms at all.