Key-based FTP authentication

Mon, 16. Mar 2015

Categories: en sysadmin Tags: authentication curl FTP Keys lftp security SSH

  1. make a strong ssh key $ [ssh-keygen](https://en.wikipedia.org/wiki/Ssh-keygen) -t rsa -b 4096 -f ~/.ssh/id_rsa
  2. turn to RFC 4716 $ ssh-keygen -e -f ~/.ssh/id_rsa.pub
  3. add to ~/.ssh/authorized_sftpkeys on destination host
  4. try out:
    1. $ [curl](http://curl.haxx.se/) -u "<username>:" --key ~/.ssh/id_rsa --pubkey ~/.ssh/id_rsa.pub -T <file to upload> sftp://<target host>/<target path>/
    2. $ [lftp](http://lftp.yar.ru/) -u <username>,xx ... sftp://<target host>

P.S.: Hetzner FAQ zum Thema SFTP + Keys.