/[cvs]/nfo/doc/computing/sysadmin/linux/howto-ssh-with-rsa-keys-(passwordless-login).txt
ViewVC logotype

Diff of /nfo/doc/computing/sysadmin/linux/howto-ssh-with-rsa-keys-(passwordless-login).txt

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed