Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Let's assume that I have a webhosting server running on my ubuntu 13.04 system. For each customer I get that wants to host a website on my server I create a user and add it to a group called 'customers'. All of these customers get a private folder in my /home/ folder, in which there is a folder tree that should not be deleted. So let's say that one of my customers' name is bob. He will get /home/bob/ as his private folder, but that folder should also contain a folder tree like this:

/home/bob/
     |
     |-> /www/
         |
         |-> /bobsdomain.com/
         |              |
         |              |-> /public_html/
         |              |-> /cgi_bin/
         |
         |-> /bobsotherdomain.com/
                        |
                        |-> /public_html/
                        |-> /cgi_bin/

Bob should obviously be the owner of /home/bob because otherwise bob couldn't create or delete files and folders inside his home folder. However, everything between /www/ and /public_html/ or /cgi_bin/ should never be removed. Everything from /public_html/ or /cgi_bin/ and down should be bob's choice wether he wants to delete it or not.

In order to do this, could I just set the folders between /www/ and /public_html/ or /cgi_bin/ as property of root, or would that cause bob being unable to add files to the /public_html/ and /cgi_bin/ folders?
If this is not possible, in what other way should I do this?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

I found the answer to my question. I chowned the folders that I didn't want to be deleted to root:root, and then chmodded these folders using 'the sticky bit' (1775 instead of 0775). This way everybody can add files and folders over ftp as they please, but they could not remove the folders that I protected with the sticky bit since you'd have to be a file or folder owner to do that.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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