You will need to make changes on the server. Since you didn't state which sftp server you are running, my guess is that the server is running vsftpd, because it is one of very few ftp server that can serve both FTP and SFTP.
If it is running vsftpd, you'll need to edit the /etc/vsftpd.conf
(or it could be in a different file in different location, especially if running virtual host). Add or change the line local_root
so that it reads local_root=/var/www/site.com/public/files/
.
Then restart the server using service vsftpd restart
. Running as root or sudoer is implied and required to make these changes. Also, don't forget to set the proper permission on the /var/www/site.com/public/files/
.
For the record! usermod -d /path/to/new/homedir/ username – Gabriel A. Zorrilla – 2009-09-02T19:54:02.330
Or edit /etc/passwd directly – innaM – 2009-09-02T19:58:48.670
That would not help me out, because i have the auto key files in the home/ftp, if i change the home dir, i'd have to move the key file to the public dir, which i do not want. – Gabriel A. Zorrilla – 2009-09-02T19:59:30.507
Your only other option is to configure sshd to search the public keys in another place. See man sshd_config and take a look at the AuthorizedKeysFile option. Of course this would change the location of the key files for all users whether they are using sftp or ssh itself. – innaM – 2009-09-03T09:13:53.017