Ubuntu 12.04‎ > ‎

Generating SSH Keys

To generate default, 2048-bit RSA keys in Ubuntu:
ssh-keygen -t rsa
This will create both the private key (usually id_rsa) and the public key (usually id_rsa.pub).

To generate a stronger RSA key, specify the number of bits using -b:
ssh-keygen -t rsa -b 4096

You may have to run the following command to have Ubuntu start using the private key:

Then you can distribute the public key to your server:
ssh-copy-id [username]@[host]