Skip to content

Crypto

RSA Key Generation

Create a new ssh public/private key pair.

Bash
1
2
3
4
5
6
7
8
# Generates a new public/private key pair in the ~/.ssh folder.
$> ssh-keygen -t rsa

# Make sure you set the correct permissions of the ~/.ssh folder.
$> chmod 700 ~/.ssh

# If you have an authorized_keys file make sure you set the correct permissions on it as well.
$> chmod 600 ~/.ssh/authorized_keys

Copy ssh keys to another box

This allows you to ssh into another box without having to type in a password.

Bash
1
2
3
4
5
6
7
8
9
$> ssh-copy-id remote_user@remote_IP
# You will be prompted for your password if the key hasn't been copied there yet.

##### CENTOS
# On CentOS you must make sure the ~/.ssh folder and ~/.ssh/authorized_keys file have the proper permissions set on the matching being ssh'd to.  See # RSA Key Generation above.

##### UBUNTU
# On Ubuntu systems you must add the private key to the local SSH authentication agent.  This is important.  You wil be prompted for a password if you don't do this step.
$> ssh-add