How to Enable SSH on Ubuntu

Secure Shell (SSH) is a cryptographic network protocol that allows secure communication between two computers. Enabling SSH on your Ubuntu server allows you to securely access and manage it remotely from another computer. There are a few simple steps to get SSH enabled.
Prerequisites
Before enabling SSH, make sure:
You have the Ubuntu server installed. SSH server comes pre-installed with all Ubuntu server editions.
Your Ubuntu server is connected to the network and has a valid IP address that other computers can reach.
Your local computer (from where you want to access the server) also has network access and SSH client software installed. All major operating systems like Linux, Windows and macOS have SSH clients you can use.
Check SSH Status
To check if SSH is currently enabled, use:
sudo systemctl status ssh
If SSH is disabled, you'll see a status like inactive (dead). If it is already running, the status will show as active (running).
Enable SSH at Install
When installing a new Ubuntu server, make sure to select the OpenSSH server package on the software selection screen to get SSH installed and enabled by default.
If you did not install the OpenSSH server earlier, you can enable SSH quickly by running:
sudo apt install openssh-server
This will install and start the SSH service.
Manually Enable SSH
If SSH was not enabled during installation, manually enable it by:
sudo systemctl enable ssh
sudo systemctl start ssh
The first command ensures SSH starts automatically on reboot. The second command starts it immediately.
Adjust Firewall Rules
If you have a firewall enabled like ufw, open the SSH port (default TCP port 22) to allow incoming connections:
sudo ufw allow ssh
You can restrict source IPs for added security in UFW to prevent SSH brute force attacks.
Connect to SSH
Once SSH is enabled and the firewall configured correctly, you can connect remotely from another computer using the SSH command with your server's IP address:
ssh username@server_ip
This will prompt for the password and log you into the Ubuntu server remotely so you can manage it securely.
SSH Server Security
There are some additional steps you should take for increased ssh security on an Ubuntu server:
Change the default SSH listening port from 22 to a custom high-numbered port.
Only allow SSH for specific user accounts used for admin logins instead of the default root account.
Set up SSH key-based authentication instead of just password logins alone.
Limit SSH access to specific source IP addresses in case of firewalls.
Following SSH security best practices is important for servers exposed directly to the internet.
That covers the basics of getting SSH enabled and set up in Ubuntu for secure remote server access. Let me know if you have any other specific questions!






