Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an FTP user which i log in into the server via SFTP and a key file. Right, lovely, works like a charm.

Now, by default the user logs to /home/ftp which is not cool. I'd like to know if there is a way to redirect just before the connection to a dir such as /var/www/site.com/public/files/

Mmm? :)

share|improve this question

Set the user's home directory to /var/www/site.com/public/files and all should be well. Of course, you'll have to move the contents of his current home directory. The command for this is:

usermod -d /path/to/new/homedir/ username

Where username is the name of the user which you are moving the home directory of.

share|improve this answer
    
For the record! usermod -d /path/to/new/homedir/ username – Gabriel A. Zorrilla Sep 2 '09 at 19:54
    
Or edit /etc/passwd directly – innaM Sep 2 '09 at 19:58
    
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 Sep 2 '09 at 19:59
    
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 Sep 3 '09 at 9:13

Another option, which could be changed by the user, is to set the starting directory to /var/www/httpd in the SFTP client software directly. FileZilla, which runs on multiple platforms, has such option, and as far as I know, most SFTP client programs have such option.

share|improve this answer

You could modify/recompile stfp-server to only use this directory and modify your sshd_config file to use this stfp-server. See Subsystem and internal-sftp options in sshd-config documentation.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .