Set linux permissions to write existing files but not create new files

Is there a recursive chmod command that will allow you to edit existing files but not create new files or directories? I have a hosting user who has a website that is constantly being hacked to host a phishing site. While he is working on closing a hole in his code, I would like to chmod his entire home directory, so new files cannot be created, but he can still update existing code to fix the hole.

+3
source share
1 answer

Permissions in directories control whether you can list (read), create (write), or search (execute) files in this directory. After a file is created, file ownership and permissions control access to this file. Therefore, you should be able to chmod a-wdirectories. However, he will not be able to recreate the files, but only modifies them. However, any hacker can change this change, unless you remove him from him. In this case, you do not have to change perms records at all.

+5
source

Source: https://habr.com/ru/post/1773968/


All Articles