Setup ubuntu server on Raspberry Pi 4 without keyboard

The "ssh" file seems to work for me. I just installed the RPi 4 with ubuntu-server 19.10.1. Here are the full instructions for anbody who finds it:

After you have installed ubuntu-server to your SD-card, mount the first partition (usually /dev/mmcblk0p1) on the machine that you installed the SD-card with.

Next, create a file called "ssh" on the filesystem root (it does not have to have any content, as long as the file is there when the pi boots the first time, it will enable ssh).

You then should find the ip address of your pi using either the web-ui on your modem, or by running the following comand from a linux box with nmap installed: nmap -p 22 / (e.g.: nmap -p 22 192.168.1.1/24)

Now you can ssh into the machine with the username "ubuntu" and password "ubuntu". It will then ask you to change the password and disconnect you. That's it, you should have a new password.


I recently purchased several RPi4's and installing Ubuntu 20.04 server on them headless most of @pasulio's advice was spot on. One thing that I've noticed with all the Raspberry Pi's is that I needed to do the steps like so from my Macbook:

  • touch /Volumes/system-boot/ssh
  • unmount SSD
  • boot RPi and ssh ubuntu@<ip>
  • Set a new password
  • Reboot the RPi

When SSH'ing into the RPi initially the screen will appear like so:

$ ssh [email protected]
Last login: Thu Sep 10 01:54:19 2020 from 192.168.13.10
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for ubuntu.
Current password:
New password:
Retype new password:
passwd: password updated successfully
Shared connection to 192.168.7.5 closed.

NOTE: Repeated attempts to SSH would only result in continual re-prompts to change the password, until a reboot.