Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 883  / 3 Years ago, mon, july 19, 2021, 3:27:31

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?


More From » directory

 Answers
6

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.


[#29785] Tuesday, July 20, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ampolinhad

Total Points: 88
Total Questions: 100
Total Answers: 116

Location: South Georgia
Member since Tue, Feb 1, 2022
2 Years ago
ampolinhad questions
Thu, Sep 8, 22, 15:45, 2 Years ago
Tue, Aug 10, 21, 20:03, 3 Years ago
Sat, Oct 16, 21, 22:44, 3 Years ago
Sat, Oct 23, 21, 03:11, 3 Years ago
Thu, Nov 17, 22, 15:34, 1 Year ago
;