This site is brought to you by the Electrical and Computer Engineering department

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 43 Next »

From your local computer (desktop, laptop) used to connect to a remote Linux server


Open a command/terminal window and enter:

ssh-keygen -t rsa

If there is a need for a 4096 bit key, use the command

ssh-keygen -t rsa -b 4096

You will be prompted to provide a filename and a password for protecting your private key.

Example Output:

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa):

To accept the default filename of id_rsa, press Enter or Return.

Password:

Enter a password at the prompt and press Enter or Return. If you press Enter or Return without entering a password, the generated private key will not be password-protection.

Your private and corresponding public keys will be created and stored at:

~/.ssh/id_rsa
~/.ssh/id_rsa.pub

Copying your public key to remote server

First, you'll need to make sure the remote server contains the file:

~/.ssh/authorized_keys

If the file does not exist, use these commands to create the remote SSH directory and authorized_keys file:

mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys

Now, copy your id_rsa.pub file on your local device over to the remote device
scp ~/.ssh/id_rsa.pub username@remoteserver.domain.com:

Add contents of Public Key file to Authorized Keys files

On the remote system, add the contents of the copied id_rsa.pub key to the authorized_keys file:

cat ~/id_rsa.pub >> ~/.ssh/authorized_keys

To check the contents of the authorized_keys file:

more ~/.ssh/authorized_keys

SSH into remote system with Public Key

ssh username@remoteserver.domain.com

For example:

ssh username@yoshi.ece.utexas.edu



  • No labels