Einloggen_Ohne_PasswortEn

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

Logging in without a password (via SSH key)

Für die deutsche Version bitte hier klicken

Here you will learn how to log on to a university server via Secure Shell (SSH) without having to enter a password at the login. (The most common problems are discussed in the FAQ section below).

  • Windows users will find a useful how-to for using SSH through !PuTTY here.
  • This how-to is primarily for Linux/Unix (including Mac OS X) users and was created using Ubuntu.

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.

1. Open a terminal on your own (not remote) system


2. Generate a pair of keys

  • Type into the terminal window: ssh-keygen -t rsa and press Enter.
  • Confirm the standard filename (id_rsa will be generated).
  • Set a “passphrase” for the key. This can be a longer sentence including spaces. The passphrase will be needed again shortly.
  • The output in the terminal should look like the picture below and as a result you now have the files idrsa and idrsa.pub in your /.ssh/ folder.

3. Copy the public key id_rsa.pub onto the remote (lxhalle) system

  • Type into the terminal window (NOTE: If your home username differs from the lxhalle-login, substitute your username for `whoami` everywhere in this tutorial) ssh-copy-id -i ~/.ssh/id_rsa.pub `whoami`@lxhalle.informatik.tu-muenchen.de and press enter.
  • Enter the login password for the lxhalle-server (NOT the “passphrase”!).
  • NOTE: On Mac OS X or where ssh-copy-id not available: Please append the idrsa.pub file manually to /.ssh/authorizedkeys on the target system.  (Create it if it does not exist.)

4. Log into the remote (lxhalle) system

  • Type ssh `whoami`@lxhalle.informatik.tu-muenchen.de and confirm.
  • Now you will need to enter the “passphrase” that you just set.

5. Set the SSH agent to automatically accept the identity

  • Type ssh-add -l and hit enter.
  • You will need to enter your “passphrase” once more.
  • If everything went right you will be able to log onto the remote system through ssh lxhalle.informatik.tu-muenchen.de 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 ssh YOUR_LXHALLE_USERNAME@lxhalle.informatik.tu-muenchen.de

6. FAQ

  • “In step 3 I’m asked to accept the authenticity of the connection (first five lines of the screenshot below). What should I do?”

Solution: Just accept by typing yes.


  • Problems with the SSH agent in step 5
     One possible problem with the SSH agent is illustrated by the screenshot below. The agent does not appear to be running.

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.