Lab 2: Passwordless SSH Access from PC and Mobile to Raspberry Pi

In this lab, I configure passwordless SSH access to a Raspberry Pi from two devices: a Windows PC and a mobile phone using Termius. The goal is to establish secure and convenient authentication withou

Objective • Enable SSH key‑based authentication from both PC and mobile • Store multiple public keys inside the file • Apply correct permissions to the directory • Verify passwordless login from both devices

Environment • Raspberry Pi OS (user: your-username) • Windows PC with an SSH key pair • Mobile device using Termius • Raspberry Pi reachable via SSH at your-raspberry-ip

1. Generate an SSH key on the PC

Create a new SSH key pair on Windows:

ssh-keygen -t ed25519 -C "your-device-name"

The public key is located in:

%USERPROFILE%\.ssh\id_ed25519.pub

2. Retrieve the SSH key from the mobile device (Termius)

Termius automatically generates an SSH key pair.

To view the public key:

  • Open Termius

  • Go to Settings → Keys

  • Select your key

  • Copy the public key

3. Add both public keys to the Raspberry Pi

Connect to the Raspberry Pi (password allowed temporarily) and open:

nano ~/.ssh/authorized_keys

Paste:

  • the PC public key

  • the mobile public key

Save and exit.

4. Set correct permissions

Ensure the .ssh directory and the authorized_keys file have the proper permissions:

  • .ssh directory → 700

  • authorized_keys file → 600

  • Owner → your-username

5. Test passwordless access

From the PC

Run:

ssh your-username@your-raspberry-ip

The login should complete without asking for a password.

From the mobile device (Termius)

Open the saved connection and verify that it logs in automatically.

Ultimo aggiornamento