I think prevent home folder from deleting is a very good idea. So I search possible approaches to do that. I that's what I’m find:
chattr +i /home/user- even root can't can add/delete/rename user folder and all direct children in user - good and bad.
Change owner of user directory to root and set sticky bit. Add file .keep and change his owner to root too:
chown root:user /home/user chmod 1775 /home/user chown root /home/user/.keep
root can delete /home/user, user can't. But user can freely add/remove/rename files in his directory
chattr +a /home/user- same as first approach but user can add files.
chattr +a on home directory:
chattr +a /home is the best way:
- We can create new home folders for other users without pain.
- We can freely edit files in /home/user
- We can't accidentally
sudo rm -rf /home/user
Actually the question: what are the pitfalls of this approach?