This site is brought to you by the Electrical and Computer Engineering department
SSH Public-key Authentication
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
You should now be able to use your key to SSH to the remote system from the computer that generated and hosting the RSA key (i.e., your laptop). You should not be prompted for a password, unless you assigned a password to the private key when it was generated.
ssh username@remoteserver.domain.com
For example:
ssh username@yoshi.ece.utexas.edu
Welcome to the University Wiki Service! Please use your IID (yourEID@eid.utexas.edu) when prompted for your email address during login or click here to enter your EID. If you are experiencing any issues loading content on pages, please try these steps to clear your browser cache.