First Time Setting Up SSH on an Ubuntu Server

AshAsh
1 min read

Ubuntu Server was installed on Proxmox, and the Proxmox console was used to access the server. The IP address of the server was found with this command:

hostname -I

After getting the IP address, a connection to the Ubuntu Server was attempted from a Windows machine on the same network. However, the connection failed with the error "Connection refused."

To make sure the IP address was correct, it was checked on the router's client list, which confirmed the correct IP. On the Ubuntu Server, this command was run to check the SSH service status:

sudo systemctl status ssh

The output showed this message:

codeUnit ssh.service could not be found.

This meant the OpenSSH server was not installed. To fix this, the OpenSSH server was installed using the command:

sudo apt update && sudo apt install -y openssh-server

After the installation, SSH was started and enabled with the command:

sudo systemctl enable --now ssh

At this point, SSH started working. To check if SSH would still work after restarting the server, the Ubuntu Server was rebooted with this command:

sudo reboot

After the restart, SSH was tested again, and it worked properly without any issues. This showed that SSH will start on its own even after the server restarts.

0
Subscribe to my newsletter

Read articles from Ash directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ash
Ash