I run CPanel on my web server and I recently needed to add an FTP account for one of the domains I am hosting. This is easy enough using the FTP Accounts option from the domain's CPanel page. However, I needed to set the home directory for the FTP account to be outside the root web directory (/home/username/public_html). This is not possible from the CPanel interface, most likely because it's a security risk. I checked my server and it shows that I'm running pure-ftpd, so I have no idea why I needed to use the proftpd directory. Heres how I did it:
[email protected]:~# cd /etc/proftpd
[email protected]:~# ls
./ savememo username2 username3
../ username4 username5 username6
[email protected]:~# vi savememo
savememo:RiIR2pPqeBWSM:32023:32024::/home/savememo:/bin/ftpsh
ftp:Ad3Dg04yDsk2dF:14:50:FTP User:/home/savememo/public_ftp:/sbin/nologin
savememo_logs:RiIR2pPqeBWSM:32023:32024:savememo:/usr/local/apache/domlogs:/bin/ftpsh
As you can see, /etc/proftpd contains a file for each of the accounts on your server. Edit the file for the domain in question, in this case savememo.com, and locate the line for the FTP account for which you wish to change the home directory. If I wanted to change the savememo FTP account's home directory to /home/savememo/myfiles, the new file would look like this:
savememo:RiIR2pPqeBWSM:32023:32024::/home/savememo/myfiles:/bin/ftpsh
After editing the file using your favorite console editor, in my case it's vi, save the file and then restart your pure-ftpd service (I'm not sure if this is required).
[email protected]:~# /etc/init.d/pure-ftpd restart
Stopping pure-config.pl:
Stopping pure-authd:
Starting pure-config.pl: [ OK ]
Starting pure-authd:
And that should do it. Now if you go into the FTP Accounts section of the CPanel for the domain you're working with, you should see the new home directory for that FTP user.