Wiki source code of Einloggen_Ohne_PasswortEn

Last modified by wikibot on 2023/02/13 19:42

Show last authors
1 = Logging in without a password (via SSH key) =
2
3 [[Für die deutsche Version bitte hier klicken>>Informatik.Helpdesk.Einloggen_Ohne_Passwort]]
4
5 Here you will learn how to log on to a university server via [[Secure Shell (SSH)>>http://en.wikipedia.org/wiki/Secure_Shell]] without having to enter a password at the login. (The most common problems are discussed in the [[FAQ section>>||anchor="FaqAnchor"]] below).
6 * (% style="color:teal" %)Windows(%%) users will find a useful how-to for using SSH through !PuTTY [[here>>Informatik.Helpdesk.Ssh_mit_PuTTYen]].
7 * This how-to is primarily for (% style="color:teal" %)Linux/Unix (including Mac OS X)(%%) users and was created using Ubuntu.
8
9
10 {{toc/}}
11
12
13
14 **WARNING:** For this tutorial we assume that you have never generated SSH keys on your system before. Please be **careful** not to overwrite existing keys.
15
16 == (% style="color:green" %)1. Open a terminal on your own (not remote) system(%%) ==
17
18 [[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/Einloggen_Ohne_Passwort/WebHome/openTerminal.png|| alt=""]]
19 ----
20
21 == (% style="color:green" %)2. Generate a pair of keys(%%) ==
22 * Type into the terminal window: {{{
23 ssh-keygen -t rsa
24 }}} and press Enter.
25 * Confirm the standard filename (##id_rsa## will be generated).
26 * Set a “passphrase” for the key. This can be a longer sentence including spaces. The passphrase will be needed again shortly.
27 * The output in the terminal should look like the picture below and as a result you now have the files ##id//rsa## and ##id//rsa.pub## in your ##~/.ssh/## folder.
28 [[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/Einloggen_Ohne_Passwort/WebHome/keyCreate.png|| alt=""]]
29 ----
30
31 {{id name="MyAnchor1" /}}
32 == (% style="color:green" %)3. Copy the public key ##id_rsa.pub## onto the remote (lxhalle) system(%%) ==
33 * Type into the terminal window ((% style="color:red" %)NOTE:(%%) If your home username differs from the lxhalle-login, substitute your username for ##`whoami`## everywhere in this tutorial) {{{
34 ssh-copy-id -i ~/.ssh/id_rsa.pub `whoami`@lxhalle.informatik.tu-muenchen.de
35 }}} and press enter.
36 * Enter the login password for the lxhalle-server ((% style="color:red" %)NOT the “passphrase”!(%%)).
37 * (% style="color:red" %)NOTE:(%%) On (% style="color:teal" %)Mac OS X(%%) or where ##ssh-copy-id## not available: Please append the ##id//rsa.pub## file manually to ##~/.ssh/authorized//keys## on the target system. (Create it if it does not exist.)
38
39 == (% style="color:green" %)4. Log into the remote (lxhalle) system(%%) ==
40 * Type {{{
41 ssh `whoami`@lxhalle.informatik.tu-muenchen.de
42 }}} and confirm.
43 * Now you will need to enter the “passphrase” that you just set.
44 {{id name="AgentAnchor" /}}
45 == (% style="color:green" %)5. Set the SSH agent to automatically accept the identity(%%) ==
46 * Type {{{
47 ssh-add -l
48 }}} and hit enter.
49 * You will need to enter your “passphrase” once more.
50 * If everything went right you will be able to log onto the remote system through {{{
51 ssh lxhalle.informatik.tu-muenchen.de
52 }}} without needing to type the password. If your username on your home computer differs from the lxhalle-login, you need to enter it in front of ##lxhalle.informatik.tu-muenchen.de## so it becomes {{{
53 ssh YOUR_LXHALLE_USERNAME@lxhalle.informatik.tu-muenchen.de
54 }}}
55 {{id name="FaqAnchor" /}}
56 == (% style="color:green" %)6. FAQ(%%) ==
57 * “In [[step 3>>||anchor="MyAnchor1"]] I’m asked to accept the authenticity of the connection (first five lines of the screenshot below). What should I do?”
58 [[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/Einloggen_Ohne_Passwort/WebHome/keyCopy.png|| alt=""]]
59
60 **Solution:** Just accept by typing **##yes##**.
61 ----
62 * Problems with the SSH agent in [[step 5>>||anchor="AgentAnchor"]]
63 One possible problem with the SSH agent is illustrated by the screenshot below. The agent does not appear to be running.
64 [[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/Einloggen_Ohne_Passwort/WebHome/SSHAgentError.png|| alt=""]]
65
66 **Solution in GNOME:** The SSH agent can be set to start automatically via //Startup Applications//. Just set the appropriate flag in the settings as shown below. You will need to log out and back in for this change to take effect.
67
68 [[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/Einloggen_Ohne_Passwort/WebHome/SSHAgentActivation.png|| height="800" alt=""]]