Project

General

Profile

Create SSH keys for Login » History » Version 1

Timo Eronen, 2016-05-04 07:42

1 1 Timo Eronen
h1. Create SSH keys for Login
2
3
As an example we create keys for *titan* cluster.
4
5
Login to the computer from which you want to access the Cluster. Change to directory *~/.ssh/*
6
7
<pre>
8
cd ~/.ssh/
9
</pre>
10
11
If you don't have such directory, create it and change into it.
12
13
Create key pair using the following command.
14
15
*DO NOT SETUP PASSPHRASE !!*
16
17
<pre>
18
ssh-keygen -f id_rsa_titan -t rsa
19
</pre>
20
21
Now you key pair:
22
23
* *id_rsa_titan* is your private key. *Keep it secret*.
24
* *id_rsa_titan.pub* is your public key.
25
26
Send the public key (id_rsa_titan.pub) to the Cluster:
27
28
*DO NOT SEND FILE id_rsa_titan WHICH IS YOUR PRIVATE KEY AND SHOULD BE KEPT SECRET.*
29
30
<pre>
31
scp id_rsa_titan.pub titan.utu.fi:
32
</pre>
33
34
Login into titan.utu.fi and while logged change into directory *~/.ssh*
35
36
<pre>
37
cd ~/.ssh/
38
</pre>
39
40
a) If you have file named *authorized_keys* add contents of id_rsa_titan.pub at the end of *authorized_keys*
41
42
<pre>
43
cat ../id_rsa_titan.pub >> ./authorized_keys
44
</pre>
45
46
b) If you don't have file named *authorized_keys* rename id_rsa_titan.pub to *authorized_keys* and move it:
47
48
<pre>
49
mv ../id_rsa_titan.pub ./authorized_keys
50
</pre>
51
52
Logout from titan.utu.fi
53
54
Edit your local config file ...
55
56
<pre>
57
emacs config
58
</pre>
59
60
... and add the following lines:
61
62
<pre>
63
Host titan
64
    User YOUR_USERID
65
    HostName titan.utu.fi
66
    IdentityFile ~/.ssh/id_rsa_titan
67
</pre>
68
69
Replace YOUR_USERID with your user id in titan.
70
71
You setup is done now and you should be able to login:
72
73
<pre>
74
ssh titan
75
</pre>