I've been trying to follow this tutorial: This Tutorial, but have come stuck at the point of logging in via public keys (without passsword prompt). I'm fairly new to unix comand line.
My scenario is, I'm running a php script (ssh2) and running the below command after successfully connecting via ssh.
ssh -f -L 3307:127.0.0.1:3306 firstname.lastname@example.org sleep 60 >> logfile
Below is the part of the tutorial I can't figure out. I've tried doing ssh-keygen and storing the public/private keys in my /home/someuser/.ssh/authorized_keys and authorized_keys.pub files. But to no avail :(, Thanks for any help.
Avoiding a password prompt: Normally, after issuing a command like the one above, you will receive a password prompt to validate the user logging into the remote machine. Again, this is bad for automation, since it's never a good idea to have an application interacting with a command line prompt (or storing plain-text passwords). Public key encryption comes to the rescue again in this case. SSH won't prompt for a password if the public certificate of remote user is stored in the ~/.ssh/authorized_keys file of the remote user account being logged into. We simply append our public key to this file and password prompts are no longer an issue.