I have a display and a USB mouse but don't have a keyboard. I realize that ubuntu asks me to enter new password for the initial user setup. Is there any alternate way to install ubuntu server without keyboard on a Raspberry pi 4? Is it possible to ssh into ubuntu server without initial setup?

  • Ubuntu server comes without a graphical user interface. I need to login first to even get to the desktop. – launchin2space Nov 29 '19 at 12:13
  • you need at least one computer that has a keyboard attached to it and the ability to modify the raspberry sdcard. You need to place a file inside the boot folder of the sdcard. The empty file needs to be named SSH. Now replug it into your raspberry pi. After booting you should now be able to ssh into your pi. – AlexOnLinux Nov 29 '19 at 16:52
  • @AlexOnLinux I do have my laptop, but that method works with Raspian OS and not on anything else. – launchin2space Nov 29 '19 at 17:05
  • I did try this from this website and still no luck. berthon.eu/2017/… – launchin2space Nov 29 '19 at 17:06
  • the default os for raspberry is raspbian. its maintained from the raspberry producers. i suggest you stick to that os. if you do not want a gui just pick the raspbian lite version. i do the same. ubuntu server did not run stable the last time i used it on my pi2 - raspberrypi.org/downloads/raspbian and follow the instructions for a headless install 3. Enable SSH on a headless Raspberry Pi raspberrypi.org/documentation/remote-access/ssh/… – AlexOnLinux Nov 30 '19 at 12:04

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

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 verified this works on Ubuntu Server 64-bit 18.04 LTS on Raspberry Pi 4. Thanks! – ATSiem Apr 15 '20 at 2:14
  • 2
    Note: You must add the SSH file before first boot. Tested on Ubuntu Server 64-bit 18.04 LTS on Raspberry Pi 4. Tried to add the SSH file after unsuccessful first boot but had to reflash the card image. – Wirewrap Jun 18 '20 at 20:09
  • @Wirewrap thanks for the extra information (that I did not even know about myself! – Pastulio Jun 21 '20 at 18:28
  • @wirewrap is there any way to reverse the first boot flag? Or is the only way to reflash the sd card? – ws6079 Nov 26 '20 at 16:41
  • @ws6079 I don’t know of any. – Wirewrap Nov 26 '20 at 22:22

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 ubuntu@
Last login: Thu Sep 10 01:54:19 2020 from
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 closed.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.