First time posting here but I have been on the forum a lot, just lurking.
I've been trying all night to get this stupid script working with a PPK file. I need to connect to an SFTP Server using a .PPK file with no password and I honestly think it is impossible.
An example of the script is below. It works perfectly when using a password but I have tried a ton of different ways to get it to work with a PPK. So the script below is a fully working one that accepts a password, I just need to be put in the right direction for it to use a PPK instead.
Code: Select all
#!/bin/sh
# FTP LOGIN
HOST='sftp://IPADDRESS'
USER='username'
PASSWORD='thisismypass'
# REMOTE DIRECTORY
REMOTE_DIR='/home/download'
#LOCAL DIRECTORY
LOCAL_DIR='/home/backup'
# RUNTIME!
echo
echo "Starting download $REMOTE_DIR from $HOST to $LOCAL_DIR"
date
lftp -u "$USER","$PASSWORD" $HOST <<EOF
# the next 3 lines put you in ftpes mode. Uncomment if you are having trouble connecting.
# set ftp:ssl-force true
# set ftp:ssl-protect-data true
# set ssl:verify-certificate no
# transfer starts now...
mirror --use-pget-n=10 $REMOTE_DIR $LOCAL_DIR;
exit
EOF
echo
echo "Transfer finished."