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?


You can make the file immutable, with:

# chattr +i filename

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

  • 1
    It's worth noting that this is OS and file-system specific (i.e. Linux and ext2/3/4). The setsebool command implies use of Apache, an alternative approach for Apache is to use Alias or AliasMatch to point the ~user/index.htm URLs to somewhere the users cannot access. – mr.spuratic Feb 2 '13 at 11:10
  • @mr.spuratic If you want to post an alternative answer just mentioning AliasMatch, I would upvote it :). – sourcejedi Feb 2 '13 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.