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 Atom on Ubuntu 18.04: GitHub’s Code Editor APT Setup

Atom is a free, open-source, cross-platform code editor developed by GitHub. Built on Electron, it uses…

3 hours ago

Install MariaDB on Ubuntu 18.04: Two Methods and Secure Setup

MariaDB is an open-source, multi-threaded relational database management system and a fully backward-compatible replacement for MySQL.…

15 hours ago

Install Odoo 11 on Ubuntu 18.04: Virtualenv and Nginx Proxy Setup

Odoo 11 is an open-source all-in-one business software platform covering CRM, e-commerce, billing, accounting, manufacturing,…

15 hours ago

Install Odoo on Ubuntu 18.04: Deploy Version 12 with Nginx

Odoo is the most widely used open-source all-in-one business software suite. It integrates CRM, e-commerce, billing,…

15 hours ago

Install phpMyAdmin with Nginx on Ubuntu 18.04: Setup and Config

phpMyAdmin is a free, open-source PHP application for managing MySQL and MariaDB servers through a browser.…

15 hours ago

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…

3 days ago