Found out a format that worked!
ssh-keygen by default generates keys like:
-----BEGIN OPENSSH PRIVATE KEY----- ...
I tried other combinations until I found one that worked:
$ openssl genrsa -out privatekey -----BEGIN RSA PRIVATE KEY----- ... $ chmod 600 privatekey $ ssh-keygen -y -f privatekey > publickey
Running the script again, results in a successful login:
localhost: Trying pubkey authentication with key file 'privatekey' localhost: Login completed, opening dummy shell channel. localhost: channel 0: new [client-session] localhost: Requesting channel_open for channel 0.