Wiki source code of Einloggen_Ohne_PasswortEn
Last modified by Aysegül Omus on 2025/01/31 12:25
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | = Logging in without a password (via SSH key) = | ||
| 2 | |||
| 3 | [[Für die deutsche Version bitte hier klicken>>CIT.ITO.Docs.Guides.Helpdesk.Einloggen_Ohne_Passwort.WebHome]] | ||
| 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 | |||
| 7 | * (% style="color:teal" %)Windows(%%) users will find a useful how-to for using SSH through !PuTTY [[here>>CIT.ITO.Docs.Guides.Helpdesk.Ssh_mit_PuTTYen.WebHome]]. | ||
| 8 | * This how-to is primarily for (% style="color:teal" %)Linux/Unix (including Mac OS X)(%%) users and was created using Ubuntu. | ||
| 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 | |||
| 22 | == (% style="color:green" %)2. Generate a pair of keys(%%) == | ||
| 23 | |||
| 24 | * Type into the terminal window: {{{ | ||
| 25 | ssh-keygen -t rsa | ||
| 26 | }}} and press Enter. | ||
| 27 | * Confirm the standard filename (##id_rsa## will be generated). | ||
| 28 | * Set a “passphrase” for the key. This can be a longer sentence including spaces. The passphrase will be needed again shortly. | ||
| 29 | * 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. | ||
| 30 | [[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/Einloggen_Ohne_Passwort/WebHome/keyCreate.png||alt=""]] | ||
| 31 | |||
| 32 | ---- | ||
| 33 | |||
| 34 | {{id name="MyAnchor1"/}} | ||
| 35 | |||
| 36 | == (% style="color:green" %)3. Copy the public key ##id_rsa.pub## onto the remote (lxhalle) system(%%) == | ||
| 37 | |||
| 38 | * 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) {{{ | ||
| 39 | ssh-copy-id -i ~/.ssh/id_rsa.pub `whoami`@lxhalle.informatik.tu-muenchen.de | ||
| 40 | }}} and press enter. | ||
| 41 | * Enter the login password for the lxhalle-server ((% style="color:red" %)NOT the “passphrase”!(%%)). | ||
| 42 | * (% 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.) | ||
| 43 | |||
| 44 | == (% style="color:green" %)4. Log into the remote (lxhalle) system(%%) == | ||
| 45 | |||
| 46 | * Type {{{ | ||
| 47 | ssh `whoami`@lxhalle.informatik.tu-muenchen.de | ||
| 48 | }}} and confirm. | ||
| 49 | * Now you will need to enter the “passphrase” that you just set. | ||
| 50 | {{id name="AgentAnchor"/}} | ||
| 51 | |||
| 52 | == (% style="color:green" %)5. Set the SSH agent to automatically accept the identity(%%) == | ||
| 53 | |||
| 54 | * Type {{{ | ||
| 55 | ssh-add -l | ||
| 56 | }}} and hit enter. | ||
| 57 | * You will need to enter your “passphrase” once more. | ||
| 58 | * If everything went right you will be able to log onto the remote system through {{{ | ||
| 59 | ssh lxhalle.informatik.tu-muenchen.de | ||
| 60 | }}} 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 {{{ | ||
| 61 | ssh YOUR_LXHALLE_USERNAME@lxhalle.informatik.tu-muenchen.de | ||
| 62 | }}} | ||
| 63 | {{id name="FaqAnchor"/}} | ||
| 64 | |||
| 65 | == (% style="color:green" %)6. FAQ(%%) == | ||
| 66 | |||
| 67 | * “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?” | ||
| 68 | [[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/Einloggen_Ohne_Passwort/WebHome/keyCopy.png||alt=""]] | ||
| 69 | |||
| 70 | **Solution:** Just accept by typing **##yes##**. | ||
| 71 | |||
| 72 | ---- | ||
| 73 | |||
| 74 | * Problems with the SSH agent in [[step 5>>||anchor="AgentAnchor"]] | ||
| 75 | One possible problem with the SSH agent is illustrated by the screenshot below. The agent does not appear to be running. | ||
| 76 | [[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/Einloggen_Ohne_Passwort/WebHome/SSHAgentError.png||alt=""]] | ||
| 77 | |||
| 78 | **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. | ||
| 79 | |||
| 80 | [[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/Einloggen_Ohne_Passwort/WebHome/SSHAgentActivation.png||height="800" alt=""]] |