I'm trying to set up a jailed SFTP user account on my own local machine to test an application with libcurl. I used this guide to help me figure out how to set up a jailed SFTP user: http://www.thegeekstuff.com/2012/03/chroot-sftp-setup/

The guide does work, but I'd like to set up public-key authentication to log in to the SFTP user's account instead of using a password. I have some basic understanding of generating and authorizing private and public keys from this guide: http://www.cyberciti.biz/tips/ssh-public-key-based-authentication-how-to.html

However, trying to add an authorized_keys2 directory in the sftp user's home directory doesn't seem to work. Any tips or advice would be helpful.

1 Answer 1


You don't need a directory authorized_keys2, you need a directory ~/.ssh and in that directory a file authorized_keys2.

  • Thanks, got that fixed. However, it still doesn't seem to work. I've copied the id_rsa.pub file from my main user to the authorized_keys2 file in the /sftp/sftpuser/incoming/.ssh directory. When I try to connect through sftp it says "Connection reset by peer".
    – sj755
    Commented Jul 4, 2013 at 19:38
  • authorized_keys2 shouldn't be used since it was deprecated twelve years ago. All keys should go into the authorized_keys file.
    – j883376
    Commented Jul 4, 2013 at 20:03
  • @sj755 What does the sshd log say? Commented Jul 4, 2013 at 20:29
  • @j883376 Changed the filename. Doesn't seem to work.
    – sj755
    Commented Jul 4, 2013 at 20:49
  • @HaukeLaging /var/log/secure doesn't seem to mention anything about my attempted logins. All it mentions are my logins to root and me catting the /var/log/secure file itself.
    – sj755
    Commented Jul 4, 2013 at 20:55

You must log in to answer this question.

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