Project

General

Profile

Actions

Create SSH keys for Login » History » Revision 7

« Previous | Revision 7/12 (diff) | Next »
Timo Eronen, 2016-05-04 08:21


Create SSH keys for Login

As an example we create keys for titan cluster.

Login to the computer from which you want to access the Cluster and change into directory ~/.ssh/

cd ~/.ssh/

If you don't have such directory, create it and change into it.

Create key pair using the following command.

DO NOT SETUP PASSPHRASE !!

ssh-keygen -f id_rsa_titan -t rsa

Now you have key pair:

  • id_rsa_titan is your private key. Keep it secret.
  • id_rsa_titan.pub is your public key.

Make sure the private key has the right protection:

chmod 400 id_rsa_titan

Send the public key (id_rsa_titan.pub) to the Cluster:

DO NOT SEND FILE id_rsa_titan WHICH IS YOUR PRIVATE KEY AND SHOULD BE KEPT SECRET.

scp id_rsa_titan.pub titan.utu.fi:

Login into titan.utu.fi and while logged change into directory ~/.ssh

ssh titan.utu.fi
cd ~/.ssh/

Depending on whether you already have file named authorized_keys continue with either Option A or Option B.

Option A) If you have file named authorized_keys add contents of id_rsa_titan.pub at the end of authorized_keys

cat ../id_rsa_titan.pub >> ./authorized_keys

Now you can get rid of file ../id_rsa_titan.pub

rm ../id_rsa_titan.pub

Option B) If you don't have file named authorized_keys rename id_rsa_titan.pub to authorized_keys and move it:

mv ../id_rsa_titan.pub ./authorized_keys

Logout from titan.utu.fi

Edit your local config file ...

emacs config

... and add the following lines:

Host titan
    User YOUR_USERID
    HostName titan.utu.fi
    IdentityFile ~/.ssh/id_rsa_titan

Replace YOUR_USERID with your user id in titan.

You setup is done now and you should be able to login:

ssh titan

Updated by Timo Eronen over 8 years ago · 7 revisions