Creating user web pages for FTP users


#1

Ok, I have my whole domain hosted on www.mydomain.com. When I FTP into my DH account using my primary user account, I log into …/ and I see www.mydomain.com as a directory inside my home dir. I also see any other subdomains in the same root, and whatever else I’ve put there.

I created a subdir: www.mydomain.com/users/ which I want to use for letting other users keep web pages. So I have dirs like www.mydomain.com/users/may, …/users/chuck, etc. I want these users to have FTP access to their own user dir, but nothing above that subdir.

Now the problem is that when I log in as the newly created FTP user, I don’t log into the same area! Under the new user I do not see the user dir that was created underneath www.mydomain.com. And when I log in as my main account, I don’t see the other user home dirs.

I don’t understand the point of this really, since the whole domain can only be hosted under the primary user account where www.mydomain.com lives. Either way, shouldnt I be able to see everything I own, all my other account dirs when logging is with the primary admin account?

How can I give an FTP user access to the mydomain.com/users/_username/ dir that I created for him to upload into? I only want that user to have access to his own user dir and anything below it, but nothing above.

Or…is there another way I should do this? making a user dir in his own home dir and somehow redirecting that dir or making it a virtual dir that shows up under mydomain.com?

Please help. Thanks,

Christian


#2

Christian,

There are many threads discussing this same, or a related, issue in this forum, and there are several suggestions how to go about it. Without rehashing all that, I’ll just say that Dreamhost’s filesystem (DH uses Debian Linux), and the way *nix operating system permissions work, make what you are trying to do rather complicated.

If you check the DH Wiki and read up on permissions, users, and ftp, if you are not totally confused you will see that, simply put, on DH every directory/file is “owned” by exactly one user - while there are “workarounds” involving the creation of “groups” and the use of “chown” and “chmod”, they are at best problematic for everyday use, inconvenient, and difficult to manage. To do so involves a lot of machinations, some domain remapping, and other unecessarily complicated (for what you are trying to accomplish) stuff.

That said, there are a other ways ways to approach the same functionality for what you are trying to do:

  1. Establish a subdomain (user.yourdomain.tld) for each user, make it fully hosted, and let the user manage their files from there. You will need to login as that user to “conveniently” share control of those files.

Pros:
a) Since they run as their own user, you can easily prevent other users from being impacted by anything “ill advised” (inordinate resource usage, spam, etc.) that they do
b) your directories are not “cluttered” with their files.
Cons:
a) You have to log into the panel or ftp using their user/pass to manipulate their files.
b) You can’t really control, other than disk space limitations, what they do (scripts they run, etc.) from their “space” conveniently.

  1. Using the directory structure you described above (/home/.dataglob/yourusername/yourdomain.tld/users/username or /home/.dataglob/yourusername/yourdomain.tld/username),what has worked best for me is simply providing them with a “filemanager” cgi program.

This is “better” to my way of thinking because I don’t have to worry about the users learning/borking the use of an ftp client, I end up the *nix “owner” of all the files, and it is “easy” for them to use and for me to set up.

I recommend a perl program for this, as there are no problems with PHP’s filesize lilmits for uploads. The “cleanest/simplest” program I have found for this is ffileman v.08, because it is so simple for me to install and for the users to use (though there are others that work just as well - check hotscripts.com for more chioces than you will want to wade through!) This provides them with a “limited” ftp-like facility that you can control to a greater degree, and since your user owns all the files, you can manipulate the contents of the directory conveniently. Installling the script I suggested it is very simple:

  1. Download the archive from sourceforge (see the provided link)

  2. Extract the file(s) from the tarball (or the zip file)

  3. Edit the “script” (just a text file) to add username/password, and a couple of other things (well documented!)

  4. Upload it via ftp to a directory on your server

  5. Set the permission on the script file to “755”

  6. Navigate to the script’s url, and enjoy.

  7. You can also avail yourself of several scripts that manage all this for you - while most cost money, there is a very servicable “free” version of a more powerful commercial script named EasyHost from cyberscripts.net, that automates this even more, and gives you even greater control.

Frankly, I think either method 2 or method 3 is far preferable than trying to allow other users ftp space that you want to be delivered under your domain.

–rlparker