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> You need sudo access.
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.
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.
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.
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.
Node.js is an open-source, cross-platform JavaScript runtime that lets you run JavaScript on the server side,…
DNS (Domain Name System) is what translates domain names into IP addresses. When you type a…
Docker is a containerization platform that lets you package applications and their dependencies into lightweight, portable…
Yarn is a fast, reliable JavaScript package manager that works alongside npm. It was built to fix…
Webmin is an open-source, browser-based control panel for Linux server administration. Instead of managing your server…
Go (also called Golang) is a modern, statically typed programming language created at Google. It is…