Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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

share|improve this answer
    
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 Jul 4 '13 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 Jul 4 '13 at 20:03
    
@sj755 What does the sshd log say? –  Hauke Laging Jul 4 '13 at 20:29
    
@j883376 Changed the filename. Doesn't seem to work. –  sj755 Jul 4 '13 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 Jul 4 '13 at 20:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.