Wednesday, November 4, 2015

chmod - Shared hosting, stop user deleting .htm file?




Hi guys I have set up a small shared hosting set up for friends.



I have set the file chmod permissions to



chmod 711 /home
chmod 711 /home/testuser
chmod 755 /home/testuser/public_html
chmod o+r /home/testuser/public_html/index.htm



How do I stop the user connected to their own ftp from deleting the html.htm file and also with the public dir set to chmod 755 I find they can't do anything in the directory such as upload/delete?



Additional info: I have run



setsebool -P httpd_enable_homedirs true
chcon -R -t httpd_sys_content_t /home/testuser/public_html


but no effect?


Answer




You can make the file immutable, with:



# chattr +i filename


then even root user won't be able to delete it.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...