Web Hosting Talk







View Full Version : Default Directory


inoverse
11-04-2001, 09:30 PM
I just need some help...I need to change the default directory for virtual sites when logging in by FTP. I did it on my first rack so that when clients log in they go directly to the /web directory, but I can't remember how I did it. Any help would be greatly appreciated. Thanks!

MaB
11-04-2001, 10:30 PM
THIS IS DANGEROUS! DANGER! :)

Now that I have said that, let me explain:

When you delete a user, it deletes the users home directory. We did this on our Cobalt Raqs until customers started complaining that their webpage files were gone! We thought it was a hacker until we realized this :)

If you MUSt you can do:
/usr/sbin/usermod -d /home/sites/siteX/web

but be warned, it aint a good idea.

jason_s
11-04-2001, 10:48 PM
This should be it.

http://www.webhostingtalk.com/showthread.php?s=&threadid=24889.

You will also want to edit your ftp.pm file so that every time you create a new virtual site, the changes you made to proftpd.conf are not overwritten.

Login to your server as root.
Type:
cd /usr/lib/perl5/site_perl/5.005/Cobalt

cp Ftp.pm Ftp.pm.backup

pico Ftp.pm

Find the section that looks like this:
<VirtualHost $ip>
DefaultRoot / admin
DefaultRoot ~/../.. $Sites_AdminGroup
DefaultRoot ~ !$Sites_AdminGroup
AllowOverwrite on
DisplayLogin .ftphelp
$anonConfig</VirtualHost>

Change it to look like this:
<VirtualHost $ip>
DefaultRoot / admin
DefaultRoot ~/../.. $Sites_AdminGroup
DefaultChDir ../../web $Sites_AdminGroup
DefaultRoot ~ !$Sites_AdminGroup
DefaultChDir ../../web
AllowOverwrite on
#DisplayLogin .ftphelp
$anonConfig</VirtualHost>

Type:
^O (control-ohh)
hit <Enter>
^X (control-x)

You're done.

Now when you add a new virtual site to your Raq, your proftpd.conf will be configured correctly so all sites will have the main /web folder as the default folder when they login via FTP. This worked for me.

MaB
11-04-2001, 10:50 PM
DAMN! Where were you all my life! Had I known I could do:
DefaultChDir ../../web siteadmin

It woudl have made my life 1000x easier. Well im depressed.

inoverse
11-05-2001, 10:54 AM
Thanks Jason, that helped a ton! Worked like a charm!