1 |
$Id$ |
$Id$ |
2 |
|
|
3 |
$Log$ |
$Log$ |
4 |
|
Revision 1.2 2003/03/20 05:57:31 joko |
5 |
|
updated |
6 |
|
|
7 |
Revision 1.1.1.1 2002/02/11 01:22:17 cvsjoko |
Revision 1.1.1.1 2002/02/11 01:22:17 cvsjoko |
8 |
first checkin' |
first checkin' |
9 |
|
|
10 |
|
|
11 |
|
|
12 |
------------------------------------------ |
------------------------------------------------------------------------------ |
13 |
- local machine: |
1. local machine (e.g.: your laptop) (want to login to remote one) |
14 |
- check if you can login to the remote machine via "normal" password authentication |
|
15 |
- create rsa-keys with "ssh-keygen" |
THIS METHOD IS a) CLUMSY AND b) DANGEROUS!!! |
16 |
- authorize yourself |
PLEASE USE METHOD 2. TO DO THIS! |
17 |
- cd ~/.ssh/ |
|
18 |
- cat identity.pub >> authorized_keys |
- check if you can login to the remote machine |
19 |
- take care of proper file-permissions |
via "normal" password authentication: |
20 |
- chmod -R og-rwx ~/.ssh |
- ssh <username>@<remote_machine> |
21 |
|
|
22 |
|
- create keys: |
23 |
|
- rsa-keys: ssh-keygen |
24 |
|
- dsa-keys: ssh-keygen -d |
25 |
|
|
26 |
|
- create authorized_keys: |
27 |
|
- cd ~/.ssh/ |
28 |
|
- rsa-keys: cat identity.pub >> authorized_keys |
29 |
|
- dsa-keys: cat id_dsa.pub >> authorized_keys |
30 |
|
|
31 |
|
- take care of proper file-permissions |
32 |
|
- chmod -R og-rwx ~/.ssh |
33 |
|
|
34 |
- authorize remote machines / distribute "authorized_keys" |
- authorize remote machines / distribute "authorized_keys" |
35 |
- scp authorized_keys <username>@<remote_machine>:~/.ssh/ |
- scp authorized_keys <username>@<remote_machine>:~/.ssh/ |
36 |
|
this is dangerous!!! it will overwrite the "authorized_keys" file completely |
37 |
|
|
38 |
- test login to remote machine |
- test login to remote machine |
39 |
- ssh <remote_machine> |
- ssh <remote_machine> |
40 |
------------------------------------------ |
|
41 |
|
2. remote machine (e.g.: a backup server) (want to login to this one) |
42 |
|
|
43 |
|
which is machine is what? |
44 |
|
<worker> the machine you are working on |
45 |
|
<remote> the machine you want to log in |
46 |
|
|
47 |
|
which account is what? |
48 |
|
<service> is the account on <worker> (this one might execute some cronjobs) |
49 |
|
<joko_backup> is the account on <remote> |
50 |
|
|
51 |
|
[key generation] one-time preparations needed for <worker>: |
52 |
|
x useradd service |
53 |
|
x su service |
54 |
|
x ssh-keygen -d |
55 |
|
|
56 |
|
[key distribution] to be executed on <remote>: |
57 |
|
x useradd joko_backup |
58 |
|
x su joko_backup |
59 |
|
x ssh service@<worker> "cat ~/.ssh/id_dsa.pub" >> ~/.ssh/authorized_keys |
60 |
|
the (") with the first (remote) command are important! |
61 |
|
otherwise your *local* shell would expand the tilde (~) |
62 |
|
|
63 |
|
[key distribution] to be executed on <worker>: |
64 |
|
This is an alternative to above if the account on <remote> already exists, |
65 |
|
and it is somehow required not to execute commands |
66 |
|
actively/manually at the <remote> side. Picture this: "the worker works". |
67 |
|
#> cat ~/.ssh/id_dsa.pub | ssh joko@netfrag.org "cat - >> ~/.ssh/authorized_keys" |
68 |
|
|
69 |
|
If the account at remote side doesn't exists, |
70 |
|
this shortcut might create it from the <worker> side as well: |
71 |
|
x ssh root@<remote> "useradd joko_backup" |
72 |
|
|
73 |
|
[login] test it on <worker>: |
74 |
|
x su service |
75 |
|
x ssh joko_backup@<remote-machine> |
76 |
|
|
77 |
|
------------------------------------------------------------------------------ |
78 |
|
|
79 |
|
|
80 |
------------------------------------------ |
------------------------------------------ |