Reputation: 1580
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.
Upvotes: 4
Views: 3884
Reputation: 93900
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.
Upvotes: 6