Generate .ssh key locally

cd ~/.ssh  

Generate a keypair. Give it a modified name, helps distinguish keys. Let’s go with ‘soup_rsa’

ssh-keygen -t rsa  

Copy public key to remote server.


SSH onto remote server

ssh soup  

If not already done, create ~/.ssh directory, then cd into `~/.ssh directory

Create authorized_keys directory

touch authorized_keys  

Move public key to ~/.ssh directory

mv ~/ ~/.ssh/  

Add public key to authorized keys

cat >> authorized_keys  

Delete public key


Exit server


  1. Add ssh config to deploy file
ssh_options[:forward_agent] = true  
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "soup_rsa")]  
  1. Ensure that private key lives on deployment server. Otherwise, you’ll be challenged with passwords during deploy.