How To

Enable SSH on Ubuntu 18.04: Install, Connect, and Manage

SSH (Secure Shell) is a cryptographic network protocol that creates a secure, encrypted connection between your local machine and a remote server. It lets you log in to remote systems, run commands, and transfer files — all over an authenticated, encrypted channel.

The SSH server is not installed by default on Ubuntu Desktop. This guide shows you how to enable SSH on Ubuntu 18.04, connect to your machine over a local network and the internet, and manage the SSH service.

<strong>Prerequisite:</strong>&nbsp;You need sudo access.

Enable SSH on Ubuntu

Install the OpenSSH server package from Ubuntu’s default repositories:

bashsudo apt updatesudo apt install openssh-server

The SSH service starts automatically once the install finishes. Verify it is running:

bashsudo systemctl status ssh

Look for Active: active (running) in the output. Press q to return to the command prompt.

If UFW firewall is enabled on your system, open the SSH port so incoming connections are not blocked:

bashsudo ufw allow ssh

SSH is now active and listening on port 22. Linux and macOS have SSH clients installed by default. Windows users can connect using PuTTY or the SSH client built into PowerShell and Command Prompt.

Connect Over a Local Network

To connect from another machine on the same network, you need your Ubuntu machine’s local IP address. Find it with:

baship a

Look for the IP address assigned to your active network interface — for example, 192.168.121.111. Then connect from the remote machine:

bashssh linuxize@192.168.121.111

The first time you connect to a host, SSH asks you to verify the server’s fingerprint:

The authenticity of host '192.168.121.111 (192.168.121.111)' can't be established.ECDSA key fingerprint is SHA256:Vybt22mVXuNuB5unE++yowF7lgA/9/2bLSiO3qmYWBY.Are you sure you want to continue connecting (yes/no)?

Type yes and enter your password. After a successful login, the Ubuntu welcome message appears and your command prompt changes to reflect the remote session. The fingerprint is saved to ~/.ssh/known_hosts so you will not be prompted again for this host.

Connect Over the Internet

To SSH into your machine from outside your local network, you need your public IP address and a router configured to forward SSH traffic to your machine.

Find your public IP by visiting https://api.ipify.org in a browser. Then set up port forwarding on your router to route incoming connections on port 22 to your machine’s local IP address. The exact steps vary by router model — check your router’s documentation.

Once port forwarding is configured, connect with:

bashssh username@public_ip_address

If you plan to keep SSH accessible over the internet long-term, disable password authentication entirely and use SSH key-based authentication instead. This removes the risk of brute-force attacks completely. You can also configure your router to forward a non-standard external port to port 22 on the server for an additional layer of security.

Disable and Re-enable SSH

To stop the SSH service:

bashsudo systemctl stop ssh

To start it again:

bashsudo systemctl start ssh

To prevent SSH from starting at boot:

bashsudo systemctl disable ssh

To re-enable it:

bashsudo systemctl enable ssh

SSH is now enabled and running on your Ubuntu 18.04 machine. You can log in remotely, run commands, and transfer files securely over any network. Leave a comment below if you run into any issues during setup.

Cyber Defence

Recent Posts

Install Node.js and npm on Ubuntu 18.04: Three Methods Compared

Node.js is an open-source, cross-platform JavaScript runtime that lets you run JavaScript on the server side,…

6 minutes ago

Set DNS Nameservers on Ubuntu 18.04: Desktop and Server Guide

DNS (Domain Name System) is what translates domain names into IP addresses. When you type a…

25 minutes ago

Install Docker on Ubuntu 18.04: Setup, Images, and Containers

Docker is a containerization platform that lets you package applications and their dependencies into lightweight, portable…

40 minutes ago

Install Yarn on Ubuntu 18.04: APT Setup and Essential Commands

Yarn is a fast, reliable JavaScript package manager that works alongside npm. It was built to fix…

45 minutes ago

Install Webmin on Ubuntu 18.04: Web Control Panel Setup Guide

Webmin is an open-source, browser-based control panel for Linux server administration. Instead of managing your server…

1 day ago

Install Go on Ubuntu 18.04: Tarball Setup and Hello World Guide

Go (also called Golang) is a modern, statically typed programming language created at Google. It is…

1 day ago