Friday, January 24, 2014

SFTP Server + JailKit on Linux

4.  TO SET UP SFTP SERVER


1. scp localhost:/opt/jailkit-2.11.tar.gz  /opt
2. cd /opt/
3. tar -zxvf jailkit-2.11.tar.gz
4. cd jailkit-2.11
5. ./configure
6. make
7. make install
8. cp extra/jailkit  /etc/init.d/
9. chmod a+x /etc/init.d/jailkit
10. mkdir /sftp
11. chmod -R 701 /sftp/home/
12. jk_init -j /sftp jk_lsh
13. jk_init -j /sftp sftp
14. jk_init -j /sftp scp
15. jk_jailuser -j /sftp srinivas
16. passwd  srinivas
17. vim /sftp/etc/jailkit/jk_lsh.ini
18. service jailkit restart
19. sftp srinivas@localhost
20. service jailkit restart

# create the account
adduser testftp

jk_jailuser -j /sftp testftp

# edit the jk_lsh configfile in the jail (man jk_lsh)

vim /sftp/etc/jailkit/jk_lsh.ini

[testuser]
paths= /usr/lib/
executables= /usr/libexec/openssh/sftp-server
allow_word_expansion =0
umask = 077


# now restart jk_socketd
/etc/init.d/jailkit restart
# test the account
sftp test@localhost
# check the logs if everything is correct
tail /var/log/daemon.log /var/log/auth.log

No comments:

Post a Comment