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 phpMyAdmin on Ubuntu 18.04 with Apache: Setup Guide

phpMyAdmin is a free, open-source PHP application that provides a browser-based interface for managing MySQL and…

1 day ago

Install Zabbix on Ubuntu 18.04: Server Setup with MySQL Backend

Zabbix is a mature open-source infrastructure monitoring platform that collects metrics from network devices, servers, virtual…

1 day ago

Install Gradle on Ubuntu 18.04: Set Up OpenJDK and Environment

Gradle is a powerful open-source build automation tool used primarily for Java, Kotlin, Groovy, and Android…

1 day ago

Install TeamViewer on Ubuntu 18.04: Download the .deb and Set Up

TeamViewer is a proprietary cross-platform remote access application for remote control, desktop sharing, file transfer, and online meetings. It is one of the most widely used remote support tools in the world, available for Windows, macOS, Linux, iOS, and Android. TeamViewer is not included in the Ubuntu repositories because it is proprietary software. This guide covers how to install TeamViewer on Ubuntu 18.04 using the official .deb package. The same steps apply to Ubuntu 16.04, Debian, Linux Mint, and Elementary OS. <strong>Prerequisite:</strong>&nbsp;You&nbsp;need&nbsp;sudo&nbsp;access. Install TeamViewer on Ubuntu: Download the .deb Package Download the official TeamViewer .deb package. The _amd64.deb suffix indicates this package is for 64-bit x86-64 systems. For ARM-based machines, download the appropriate package from the TeamViewer Linux downloads page: bashwget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb Install the package using apt. The ./ prefix tells apt this is a local file path, not a package name from the repositories:…

1 day ago

Install Nagios Core on Ubuntu 18.04: Build from Source Guide

Nagios is one of the most widely used open-source infrastructure monitoring systems in the world. It…

2 days ago

Install Laravel on Ubuntu 18.04 with Composer: Setup Guide

Laravel is an open-source PHP web application framework built around an expressive, developer-friendly syntax. It is…

2 days ago