ScreenshotNeo

BlogGuides

What Is Headless Linux and When Should You Use It?

Headless Linux runs without a permanently attached monitor or keyboard. Learn how SSH setup, security, hardware choices and automation fit together.

By the ScreenshotNeo team1 October 202611 min read

Headless Linux is Linux running without a permanently attached monitor, keyboard or mouse. You administer it over a network, usually with SSH, while services and applications run in the background. The machine can still have graphical libraries or a desktop installed; “headless” describes how it is operated, not whether Linux is capable of displaying a GUI.

Use a headless setup when the computer will provide a network service, run automation or CI jobs, host files or media, act as a home-lab node, or sit in an enclosure or remote location. Use a desktop when people must work locally in graphical applications or when a local display is part of the product.

1. What headless Linux means

Raspberry Pi defines a headless computer as a system that “operates without traditional peripherals (display, keyboard, and mouse).” A headless Linux machine still has a user interface: its shell is reached remotely, and many services expose web dashboards or APIs.

  • Local console: a monitor and keyboard are attached directly.
  • Headless: routine administration happens remotely through SSH, a web interface, a serial console or an orchestration system.
  • Remote desktop: a graphical session is streamed over the network with tools such as VNC or RDP. This can be used on a headless machine, but it is not required.

Headless does not mean unattended forever. Keep a recovery path such as a serial console, out-of-band management, a spare display, or physical access before placing hardware somewhere difficult to reach.

2. When should you use a headless setup?

Network services

Web servers, databases, DNS, VPN endpoints, Git hosting and monitoring systems are normally controlled through commands, APIs or browser dashboards. A desktop consumes resources without helping the service.

Home labs and storage

File servers, backup targets, media servers and container hosts can run in a cupboard or rack. Ethernet is usually preferable where consistent throughput matters.

Automation and CI

Build workers, scheduled jobs, test runners and deployment machines need repeatable processes rather than a logged-in desktop session. SSH and service managers make these systems easy to provision and restart.

Embedded and remote computers

Raspberry Pi boards, gateways, sensors and industrial controllers often have no practical place for a permanent display. Raspberry Pi OS Lite is explicitly intended for headless servers, embedded systems and older Raspberry Pi models.

When a desktop is the better choice

Choose a desktop installation when a person must use local GUI applications, when the workload depends on a full display server, or when local troubleshooting is frequent and remote access is not reliable. You can also install only the GUI libraries an application needs instead of a complete desktop environment.

3. How remote access works

A headless computer needs three things: network connectivity, a listening remote-access service and credentials accepted by that service.

  1. Network: connect Ethernet or configure Wi-Fi during imaging or first boot.
  2. Address: find the device by hostname, DHCP lease or a reserved IP address.
  3. SSH server: enable and start sshd on the machine.
  4. Client: use an SSH client from Linux, macOS or Windows.
  5. Authorization: authenticate with an SSH key and use sudo for administration.

Raspberry Pi documents SSH and Raspberry Pi Connect for first access; VNC can be enabled later on editions that include a desktop. SSH is the normal command-line path because it works from almost any development computer.

# Connect by hostname
ssh admin@my-pi.local

# Connect by IP address
ssh admin@192.0.2.25

# Specify a private key
ssh -i ~/.ssh/id_ed25519 admin@192.0.2.25

4. Initial setup without a monitor

Step 1: Write the operating-system image

Use Raspberry Pi Imager for a Raspberry Pi, or the imaging tool recommended by your board vendor. Select Raspberry Pi OS Lite when you do not need a desktop. For supported boards, Ubuntu Server can be provisioned with cloud-init.

Step 2: Preconfigure identity and networking

During imaging, configure a hostname, a non-root user, an SSH public key and Wi-Fi credentials if Ethernet is unavailable. Preconfiguration avoids the first-boot “chicken and egg” problem in which SSH is not reachable because the account or network has not yet been created.

For Ubuntu cloud-init, first-boot data can create users, import SSH keys and configure networking before anyone attaches a screen.

Step 3: Boot and discover the machine

# Linux or macOS: inspect the local ARP/neighbor table
ip neigh

# Resolve a configured hostname
getent hosts my-pi.local

# Test whether SSH is reachable
nc -vz my-pi.local 22

On Windows, use the router’s DHCP client list or PowerShell’s Test-NetConnection command:

Test-NetConnection my-pi.local -Port 22

Step 4: Make the first SSH connection

ssh admin@my-pi.local

# Confirm the host key when prompted, then verify the system
hostnamectl
ip addr
lsblk

Step 5: Update before installing services

sudo apt update
sudo apt full-upgrade -y
sudo reboot

Reconnect after the reboot and verify that the machine received the expected hostname, address and time.

Step 6: Create least-privilege administration

# Create an administrator account if imaging did not do so
sudo adduser ops
sudo usermod -aG sudo ops

# Install the SSH server when it is not already present
sudo apt install -y openssh-server
sudo systemctl enable --now ssh

Keep daily work under a normal account and elevate individual commands with sudo. Avoid routine root SSH logins.

5. SSH key authentication and baseline security

Use public-key authentication. Ubuntu’s headless cloud-init guidance strongly recommends leaving SSH password authentication disabled because default usernames and passwords are well known and guessable.

# Create a modern key on your client
ssh-keygen -t ed25519 -C "headless-admin"

# Copy the public key to the server (one-time password login may be required)
ssh-copy-id ops@my-pi.local

# Test key-only access
ssh -o PreferredAuthentications=publickey ops@my-pi.local

After confirming key access, harden the SSH daemon. Review the distribution’s configuration layout before editing it; a drop-in file under /etc/ssh/sshd_config.d/ is often easier to maintain.

sudoedit /etc/ssh/sshd_config.d/10-headless-hardening.conf
PasswordAuthentication no
PermitRootLogin no
PubkeyAuthentication yes
# Validate before reloading
sudo sshd -t
sudo systemctl reload ssh

Also apply security updates, remove unused services, restrict inbound traffic with a firewall, and prefer a VPN or private network for administration. Do not expose SSH directly to the public internet without a deliberate network-security plan. Keep a second recovery path before disabling passwords.

# Example: allow SSH and enable the uncomplicated firewall
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose

6. Operating a headless machine day to day

Services and startup

systemctl status ssh
systemctl list-units --type=service --state=running
journalctl -u ssh --since today

# Enable an application at boot
sudo systemctl enable --now my-app.service

Logs, processes and storage

df -h
free -h
uptime
top
journalctl -p warning..alert --since "1 hour ago"

# Find large directories
sudo du -xhd1 /var | sort -h

Backups and recovery

Back up application data, configuration, SSH recovery keys and a tested restore procedure. A second copy on another device protects against storage failure; a backup that has never been restored is only an assumption.

Monitoring

At minimum, monitor disk space, memory pressure, temperature where relevant, failed systemd units, backup success and network reachability. Alerting should use a path independent of the service being monitored.

7. Raspberry Pi OS Lite versus Ubuntu Server

Consideration Raspberry Pi OS Lite Ubuntu Server
Best fit Raspberry Pi headless servers, embedded projects and older Pi hardware Supported boards where Ubuntu packages and server tooling are the priority
Provisioning Raspberry Pi Imager can configure credentials, hostname, networking and SSH Cloud-init can create users, import keys and configure first boot
Packages Debian-based Raspberry Pi ecosystem Ubuntu package and server-management ecosystem
Choose based on Board support, low overhead and Pi-specific guidance Required packages, fleet tooling and your team’s Ubuntu experience

There is no universal winner. Compare hardware support, CPU and RAM needs, power draw, storage endurance, package availability, remote-access defaults and recovery tooling for the workload you will actually run.

8. Common problems and fixes

Symptom Likely cause Fix
ssh: Could not resolve hostname Hostname discovery or local DNS is unavailable Use the DHCP-assigned IP, check getent hosts, or configure a local DNS reservation.
Connection timed out Wrong address, no network link, firewall or device still booting Check link lights and DHCP leases, then test port 22 from the same network.
Connection refused SSH server is not running or is listening on another port Use a console or recovery path to run systemctl status ssh and inspect ss -ltnp.
Permission denied (publickey) Wrong user, key, permissions or authorized-keys location Confirm the username, use the matching private key, and ensure the server account owns ~/.ssh with restrictive permissions.
Host key warning after reinstall The machine was reimaged and generated a new host key Verify the reinstall through a trusted channel, then remove the old entry with ssh-keygen -R hostname.
System works locally but not remotely Service binds only to loopback or a firewall blocks its port Check the service bind address, listening sockets and firewall rules.
Storage fills unexpectedly Logs, container layers, caches or media files grow without limits Inspect journalctl --disk-usage, rotate logs and set retention limits.
Wi-Fi disappears after reboot Incorrect credentials, country settings, weak signal or power management Check NetworkManager/systemd-networkd logs, verify the regulatory country and prefer Ethernet for critical nodes.
Updates leave the host unreachable Kernel, network or SSH configuration changed Keep console or serial recovery, validate SSH configuration before reload, and stage updates on a test machine.

9. Performance, reliability and cost

Performance

Removing a desktop reduces background CPU, memory and storage use, but the application workload still determines hardware needs. Measure CPU, RAM, I/O and network usage under realistic load. Use SSD or reliable flash storage for write-heavy services, and account for cooling and power limits on small boards.

Reliability

Headless operation increases the value of automation and observability. Make services restartable, configure health checks, keep backups, reserve an IP address for important nodes and document out-of-band access. A remote machine without recovery access can turn a small configuration error into a physical visit.

Cost

A headless deployment can avoid the cost and power draw of a dedicated monitor and peripherals. Budget for the board or server, power supply, storage, networking, cooling, replacement media and backup storage. The lowest purchase price is not the lowest operating cost if storage failures or unplanned visits are common.

10. Capturing a remote machine’s web output

Headless Linux hosts often run dashboards, status pages and internal web applications. You can capture those pages from a browser running on the server, but browser setup adds packages, sandbox permissions, fonts, timing controls and maintenance.

DIY browser approach

# Install a browser and common dependencies on Debian or Ubuntu
sudo apt update
sudo apt install -y chromium

# A minimal screenshot command (Chromium flag names may vary by release)
chromium --headless --disable-gpu --no-sandbox \
  --window-size=1440,900 \
  --screenshot=dashboard.png \
  https://example.com

For production capture, add a dedicated service account, a writable temporary directory, explicit fonts, timeouts, retry limits and a process supervisor. Treat --no-sandbox as a deployment trade-off and follow your distribution’s browser security guidance. If the page needs JavaScript, authentication, cookie consent handling or lazy-loaded images, a scripted browser such as Playwright or Puppeteer gives finer control.

11. Or skip the browser setup

ScreenshotNeo provides a website screenshot API for headless workflows. One GET request returns PNG, JPEG, WebP or PDF. Cookie and consent banners are accepted and 60+ known consent platforms, newsletter popups and chat widgets are removed before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing result.

See the ScreenshotNeo API documentation for the full option set. The endpoint supports full-page or CSS-element capture, dark mode, device presets and custom viewports, retina scale, PDF paper and page options, custom CSS and JavaScript, clicks, selector waits, delays, network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture and a usage API.

cURL

curl -G "https://api.screenshotneo.com/v1/shot" \
  -d access_key=YOUR_API_KEY \
  --data-urlencode url=https://example.com \
  -o shot.webp

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const body = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', body));

ScreenshotNeo has an MCP server with take_screenshot, get_page_info and capture_pdf tools, so Claude, Cursor and other MCP clients can operate it without browser management. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

12. A practical deployment checklist

  • Choose hardware with enough CPU, RAM, storage endurance and cooling for the workload.
  • Install a minimal server image when no local GUI is required.
  • Preconfigure hostname, user, SSH key and networking during imaging.
  • Use Ethernet or a reliable wireless design and reserve the machine’s address.
  • Update the operating system before installing applications.
  • Use a non-root account, sudo, public-key SSH and a firewall.
  • Keep console, serial, VPN or physical recovery access.
  • Enable service supervision, log retention, monitoring and tested backups.
  • Document ports, accounts, restore steps and the location of recovery media.
  • Test a rebuild from a blank image before the machine becomes critical.

13. FAQ

Can Linux run without a monitor?

Yes. Linux can boot and run services without a display or input peripherals. Administer it through SSH, a web interface, a serial console or an orchestration tool.

How do I SSH into a headless Raspberry Pi?

Use Raspberry Pi Imager to configure the hostname, user, Wi-Fi or Ethernet and SSH key, boot the Pi, discover its hostname or IP address, then run ssh user@host.

Is Ubuntu Server better than Raspberry Pi OS Lite?

It depends on the board and workload. Raspberry Pi OS Lite is explicitly aimed at Pi headless and embedded use; Ubuntu Server is attractive when Ubuntu packages, cloud-init or existing fleet tooling matter.

Do I need a desktop environment on a Linux server?

No, unless the workload or local operators need graphical applications. A minimal image is usually simpler to update and monitor.

Can I use a headless machine for GUI applications?

Sometimes. Install the required display libraries and use a virtual display or remote desktop when needed. A full desktop is only necessary when the application depends on it or local GUI work is part of the requirement.

What happens if SSH breaks?

Use a documented recovery path such as a serial console, local display, provider console, Raspberry Pi Connect or a VPN jump host. Keep configuration validation and backups so recovery does not depend on guesswork.