To SSH into a Raspberry Pi, enable the SSH server (with raspi-config, an empty file named ssh on the boot partition, or Raspberry Pi Imager), locate the Pi on your network via hostname.local or its IP, and run ssh [email protected] on port 22. Then change the password and switch to Ed25519 keys.

How to enable SSH on a Raspberry Pi with raspi-config or the ssh file

sudo raspi-config turns on the SSH server from the Pi itself, under Interface Options → SSH → Yes. You only need a monitor and keyboard once, or a local session that is already open. To skip the menu, non-interactive mode does the same in one line:

sudo raspi-config
# Interface Options → SSH → Yes

# Same thing without the menu (0 = enable)
sudo raspi-config nonint do_ssh 0

# systemd alternative
sudo systemctl enable --now ssh
systemctl status ssh

Without a monitor (headless) you have two routes. The first is Raspberry Pi Imager: its customisation options let you set the hostname, user and password and tick “Enable SSH” before writing the card. The second is the ssh file: an empty file with exactly that name, no extension, on the boot partition (the FAT volume you see when the card is plugged into your computer). On boot, the system detects it, enables SSH and deletes it.

# macOS / Linux, with the card mounted
# (the volume may be called boot or bootfs)
touch /Volumes/bootfs/ssh

# Windows (PowerShell), if the boot partition is E:
New-Item E:\ssh -ItemType File

Watch out on Windows: with extensions hidden, Explorer may save ssh.txt. That name does not work.

4 ways to find a Raspberry Pi's IP address on your local network

The name raspberrypi.local reaches the Pi over mDNS without knowing its IP, as long as you kept the default hostname and your system resolves .local names. If you changed the hostname in Imager, use yourhostname.local. When mDNS fails, look up the IP instead:

ping raspberrypi.local          # mDNS
hostname -I                     # on the Pi itself
nmap -sn 192.168.1.0/24         # subnet scan (adjust it)
arp -a                          # local ARP table
Method to locate the PiWhat you needFrom a desktopFrom iOS/Android
hostname.localmDNS on the network and clientWorks if the OS resolves .localDepends on OS and network; fall back to the IP
hostname -IMonitor and keyboard on the PiNot applicable: read on the PiNot applicable: read on the Pi
Router DHCP client listAccess to the router admin pageBrowserMobile browser
nmap -snnmap installedStraight from the terminalBetter from another machine on the network

Practical tip: reserve the Pi's IP in the router's DHCP settings. The address stays fixed and saved connections keep working.

Connecting to a Raspberry Pi over SSH from a computer or a phone

OpenSSH listens on TCP port 22 by default, so the user plus the name or IP is enough:

ssh [email protected]
ssh [email protected]

# After reflashing the card the host key changes:
ssh-keygen -R raspberrypi.local

On the first connection the client shows the server fingerprint and asks you to confirm. If you later write a fresh image, you will get “REMOTE HOST IDENTIFICATION HAS CHANGED”: that is expected, and ssh-keygen -R removes the stale entry from known_hosts.

From a phone the flow is identical, but the system keyboard hides Esc, Ctrl and Tab, which raspi-config, nano and vim rely on. The termi1 SSH terminal adds those keys, arrows and an fn layer with F1–F12. If you install mosh on the Pi (sudo apt install mosh), the session survives switching from wifi to mobile data; Mosh uses UDP on ports 60000-61000 and starts mosh-server through an initial SSH connection. With tmux, whatever you leave running is still there when you come back. Get it from termi1 on Google Play or the App Store.

Changing the Raspberry Pi password and switching to Ed25519 keys

passwd changes the current user's password and is the first command to run if the image ships with known or weak credentials. The next step is to stop relying on passwords altogether: OpenSSH has supported Ed25519 keys since version 6.5 (January 2014).

# On the Pi
passwd

# On your machine
ssh-keygen -t ed25519
ssh-copy-id [email protected]

# On the Pi: expected permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

# /etc/ssh/sshd_config
PasswordAuthentication no

sudo systemctl restart ssh

Before restarting the service with PasswordAuthentication no, test the key in a second session without closing the first. If ~/.ssh is not 700 or authorized_keys is not 600, sshd will ignore the key. Every directive is described in the sshd_config manual page.

In termi1 the key can be generated on the phone itself and is kept in the system's secure storage; the private key never leaves the device and is never sent to termi1 servers. If you dictate “change my password” to the AI, the command is typed at the prompt without pressing Enter; in “Review” mode Enter is never pressed.

Reaching a Raspberry Pi away from home without opening port 22

Forwarding port 22 on your router to the Pi exposes it to the whole internet. A private mesh network such as the Prialo private network or Tailscale reaches the Pi without a public IP or open ports: install the client on the Pi and on the phone, then connect to the mesh address. Keep in mind that Mosh does no port forwarding or X11 forwarding; use SSH for tunnels.

Frequently asked questions

What is the SSH username on a Raspberry Pi?

The SSH username on a Raspberry Pi is the one you set when preparing the card, for example in Raspberry Pi Imager's options. If your image uses well-known default credentials, change them as soon as you log in with passwd and set up an Ed25519 key.

Why is raspberrypi.local not working?

The raspberrypi.local name fails if you changed the hostname, if the network blocks mDNS, or if your system does not resolve .local names. Try the hostname you chose, check the router's DHCP client list, or scan the subnet with nmap -sn to get the IP.

Can you enable SSH on a Raspberry Pi without a monitor?

Yes, SSH can be enabled without a monitor by creating an empty file named ssh, with no extension, on the card's boot partition, or by ticking “Enable SSH” in Raspberry Pi Imager before writing it. On boot, the Pi starts the server on port 22.

How do I SSH into a Raspberry Pi from my phone?

SSH into a Raspberry Pi from a phone needs an SSH client, the IP or hostname.local, and the username. A keyboard with Esc, Ctrl and Tab helps with raspi-config, and Mosh keeps the session alive when the phone moves from wifi to mobile data.