Users - Restricting Users to Specific Domain FTPs


#1

I have set up a default domain with the default main user when I signed up with Dreamhost.

I then added another domain and another user.

How do I restrict the new user’s access to a specific domain or ftp of that domain?

Any help would be great.


#2

This is what I wrote up in another thread, note that it doesn’t matter if its a domain or a subdomain you wish to add:

OK Here’s an overview.

With you DreamHost account, you have access to a machine cluster which shares its files using a filesystem. You get a “user” in which and space is set aside on the filesystem for this user to use for his files, such as mail and web files, among other things. This space is called the “home directory”. And each additional user you create gets his own home directory, too.

Now the web server is a program and it needs to know in what directory the files are for a certain domain. The “root” directory for a domain is called DocumentRoot in Apache, however the web panel calls it “Web Directory”.

Scenario A:

You just registered yourdomain.com and first day at DreamHost. Your username is “yourself” and this means you when you log into FTP as “yourself” you are accessing
/home/yourself
on the filesystem. You’ll probably see a directory named “yourdomain.com” there, because usually DreamHost sets DocumentRoot for your domain to “/home/yourself/yourdomain.com”.
So all files inside that directory show up at “http://yourdomain.com/” in your browser. Note: The directory does not have to have be the same name as the domain.

OK Lets say you need to make a subdomain call “subdomain.yourdomain.com” and another person needs to upload files himself to that subdomain. First create the user, “someone”. Then create the subdomain. When creating the subdomain, chose his “someone” in all the drop-down menus. Then you will have:
someone’s home directory = /home/someone
subdomain.yourdomain.com Web Directory / DocumentRoot = /home/someone/subdomain.yourdomain.com
CGI runs as user: someone
When “someone” logs into FTP, he will be accessing his home directory, and he should have a directory called “subdomain.yourdomain.com” there. All files in that directory will show up at
"http://subdomain.yourdomain.com/"

Now you’ll notice throughout that whole process of the new user and new subdomain we never mentioned “yourself” or “/home/yourname” or “/home/yourname/yourdomain.com” - this means “yourself” and its files are out of the FTP picture when it comes to the files used for the subdomain.

Now, if on the other hand you want
http://yourdomain.com/users/someone/
to show files that “someone” uploaded, but
http://yourdomain.com/
to show files that “yourself” uploaded, you want to use the “Re-map Sub-Dir” function of the web panel. The setup is a bit different, for example you have to create the directory that your re-mapping to if it doesn’t already exist. However the same thing about FTP applies: only login as the user that is supposed to have access to the files.

:cool: Perl / MySQL / HTML+CSS