Skip to content

SSH Connection with No Password

Christopher Hopkins edited this page Nov 9, 2015 · 9 revisions

Useful if you frequently connect to a remote machine using ssh.

Prerequisites:

  • SSH server running on remote machine (Obvious)
  • ssh client on you local machine

Step 1: Generate a ssh key pair on the local machine

$ ssh-keygen -t rsa -b 4096

The -t option allows you to specify the key type. The -b option allows you to specify the key size.

You will be prompted to enter a filename and password (both can be left default/blank).

Step 2: Copy the public key to the remote account/machine

 $ ssh-copy-id user@remote_machine

You will be prompted to enter the password for the account on the remote_machine.

Note: ssh-copy-id is a available on most Linux distributions. If you are in a Mac OS X environment, then you can add this command using this Github repository.

Step 3: Attempt a SSH connection using the installed keys

 $ ssh user@remote_machine

Clone this wiki locally