Search Authority

Ubuntu Enable SSH: Secure Remote Access Guide

Enabling SSH on Ubuntu lets you manage servers and connect to machines securely over the network. This capability is essential for remote administration, automation, and trouble...

Mara Ellison Jul 11, 2026
Ubuntu Enable SSH: Secure Remote Access Guide

Enabling SSH on Ubuntu lets you manage servers and connect to machines securely over the network. This capability is essential for remote administration, automation, and troubleshooting.

With the right steps, you can configure secure access, control user permissions, and integrate SSH with your existing workflows.

Feature Description Default Recommendation
Service Name Name of the SSH daemon ssh Use standard package install
Port TCP port for inbound connections 22 Change if avoiding common scans
Protocol SSH protocol version used 2 Force SSH protocol 2 only
PasswordAuth Allow login via password enabled on desktop Disable for servers
PermitRootLogin Allow root SSH access prohibit-password Set to no for hardening

Install OpenSSH Server Package

The OpenSSH server package provides the sshd daemon required to accept remote connections. Ubuntu includes the client by default, but the server must be installed explicitly.

Use the package manager to install the package and let the system enable the service automatically. This step integrates cleanly with systemd and networking.

Configure SSHD Settings

Adjusting sshd configuration tailors security, access rules, and network behavior to your environment. The main configuration file is located at /etc/ssh/sshd_config.

Key Options to Review

  • Port: Choose a non-standard port to reduce automated noise
  • PermitRootLogin: Set to no to block direct root logins
  • PasswordAuthentication: Disable when using key-based auth
  • AllowUsers: Limit access to specific accounts

Manage Service and Firewall

After changes, restart the daemon to apply the updated configuration. Ensure the firewall allows the chosen port so connections are not silently dropped.

Systemd simplifies runtime control, while ufw or nftables provide straightforward rule management for IPv4 and IPv6 traffic.

Test and Verify SSH Access

Testing from another terminal or machine confirms that connectivity, authentication, and routing are working as intended. Use verbose output to diagnose unexpected failures without locking yourself out of the console.

Keep a current rescue method available when managing remote systems to recover from misconfigurations quickly.

Secure Remote Management on Ubuntu

Following these focused steps helps you enable ssh ubuntu safely and maintain reliable remote access over time.

  • Install the openssh-server package using the official repositories
  • Review and adjust key sshd settings for security and usability
  • Configure the firewall to permit traffic on the chosen port
  • Restart and verify the service with ss or systemctl>
  • Test access from a separate session before closing current connections

FAQ

Reader questions

How do I enable SSH on Ubuntu without a GUI?

Install openssh-server with apt, then start and enable the service using systemctl. Adjust settings in /etc/ssh/sshd_config as needed and reload the daemon.

Can I change the SSH port after enabling it?

Yes, modify the Port directive in sshd_config, update any firewall rules, and restart the service. Verify the new port is reachable before closing the old one.

What should I do if I lock myself out of SSH?

Access the machine via console or another administrative session, correct the configuration, and ensure at least one allowed user and a working authentication method exist.

How can I confirm SSH is listening on the correct interface?

Use ss or netstat to check the listening sockets, and verify that sshd binds to the expected address and port combination.

Related Reading

More pages in this topic cluster.

Baby Growth Spurts: Navigating Rapid Developmental Leaps

Baby growth spurts are rapid increases in weight and length that can transform a sleepy newborn into a more demanding, fussier feeder almost overnight. These short but intense p...

Read next
Olecranon Process Anatomy: The Elbow's Key Bone Structure

The olecranon process is the prominent bony point of the elbow, forming the upper extremity of the ulna. It functions as a lever arm that transmits forces from the triceps muscl...

Read next
Mastering Economics Current Account: Balance, Trade & Prosperity

The economics current account captures a nation's net transactions with the rest of the world, including trade in goods and services, primary income, and secondary transfers. Un...

Read next