PDA

View Full Version : Workaround: More than 1 FTP user for /var/www/html



FZ
10-02-2003, 03:58 PM
I know many people were having a problem with this. So I sat down and I thought about it long and hard. There must be a way around this. The Site Manager probably only does the "this directory exists already" thing to make sure one FTP user cannot change files that belong to another FTP user - unfortunately it does not discriminate against those FTP users that have access to the www files/docs. Then it occurred to me... Why not use exactly what the VDS uses: symlinks (symbolic links). They'll fool the VDS into thinking that each is its own directory, thereby allowing you to give more than one FTP user access to your www folder.

Here's how to do it:

1. You need to use SSH for this one. Fire up your SSH program and log in.

2. Change to the /www directory by typing the following and pressing enter (at the prompt):


cd /www

3. Now for the juicy part: making the symlink. Type the following at the prompt and press enter:


ln -s htdocs ftpusername

Where you would replace ftpusername with whatever you want (I recommend calling it the actual FTP username). For those that don't know what a symlink is, it's kind of like a shortcut icon on your Windows desktop to a directory actually located somewhere else. In this case it is a "shortcut" to the www folder. In other words, if you typed cd /www/ftpusername after creating the symlink, the contents that would show up in that directory are the contents from /var/www/html!

4. Now log in to your Site Manager (you need not login only after doing the above - it is fine to have already been logged in). Add the new E-mail/FTP account using E-mail/FTP Management, and for Home Directory specify /www/ftpusername (where ftpusername is what you called it - as above), and check Use Existing Directory.

5. Enjoy.

I did some simple testing, and it does seem to work as expected. There might be bugs though, so give it a good thorough testing before you use it on a production site. If you do find anything out of place, please post here for others to see what potential problems there are (if any).

Bugs:
- the FTP quota no longer works as expected. The quota is enforced as expected, however all files in the www directory already count against the particular user's quota, so this solution is best for when you don't need to set a limit.

avila
10-02-2003, 09:17 PM
Fayez, you are *incredible!* Thank you so much for this.

I just tried your workaround as above, and had no problems at all until I went to Site Manager and tried to change the Home Directory. For some reason (most likely my error) I got this message:

/www/avila is not a valid directory.

I'll keep trying. I think your solution *will* work, once I've found a parameter for home directory acceptable to Site Manager.

Thanks again. Your help is greatly appreciated.

FZ
10-03-2003, 09:10 AM
Hi avila,

I'm glad it (kind of) worked. I tried in vain to recreate the error message you got, so could you be more specific as to exactly what you did to get it, please? I did create an FTP account and then try to change its home directory to /www/ftpusername but that does not work since the Site Manager tries to rename the old directory to the new one (and since the destination exists already...) So I guess for that, unfortunately, you need to remove the FTP account(s) before you can make use of the workaround (or let them make the directory in /www and then use SSH to delete the directory and replace it with a symlink). Besides that, the errors I got were "legit".

I'd love to be able to help you get this working 100%... Until then it isn't of much use as a workaround, is it!

avila
10-04-2003, 11:25 PM
Hi, Fayez.



I'm glad it (kind of) worked. I tried in vain to recreate the error message you got, so could you be more specific as to exactly what you did to get it, please? I did create an FTP account and then try to change its home directory to /www/ftpusername but that does not work since the Site Manager tries to rename the old directory to the new one (and since the destination exists already...) So I guess for that, unfortunately, you need to remove the FTP account(s) before you can make use of the workaround (or let them make the directory in /www and then use SSH to delete the directory and replace it with a symlink). Besides that, the errors I got were "legit".

It works beautifully as long as your workaround is followed exactly. When I tried this on existing accounts, the error message I received was:

"Failed to rename directory to www/avila"

However, after using the shell commands for symlinks that you created:
cd /www
ln -s htdocs avilaftp

and then adding new user, avilaftp, in Site Manager, it's absolutely perfect. I added several new accounts and checked them in FTP. Every one worked flawlessly, with /www/ permissions enabled.



I'd love to be able to help you get this working 100%... Until then it isn't of much use as a workaround, is it!

I can't thank you enough, Fayez. We're fully operational for the first time since 8 September. Your help has been invaluable to me.

FZ
10-05-2003, 09:40 AM
Avila,

I'm really glad to hear that - knowing I've helped someone so much is reward enough for me. You're always welcome.