Ubuntu is a widely used open-source Linux distribution that provides a user-friendly operating system. It is known for its stability, ease of use, and robust community support. Ubuntu is developed and maintained by Canonical Ltd. It offers a range of features, including a graphical desktop environment, a package management system (APT), and access to a vast repository of free and open-source software. Before going to perform how to Enable SSH on Ubuntu let’s see the overview of the SSH in Linux system.
So, SSH stands for the Secure Shell, which is a widely used cryptographic network protocol for securely accessing and managing remote systems over an unsecured network. In Linux, SSH is an essential tool for remote administration and file transfer.
SSH Features –
- Encrypted Communication: SSH encrypts data during communication, ensuring confidentiality.
- Authentication Methods: Supports password-based and key-based authentication methods for secure access.
- X11 Forwarding: Supports secure graphical user interface (GUI) forwarding over the SSH connection.
- Remote Access: Allows users to log in to a remote machine securely over an untrusted network.
- Secure File Transfer: Facilitates secure file transfer between systems through tools like SCP and SFTP.
- Multifactor Authentication: Supports multifactor authentication for an additional layer of security.
- Secure Shell Tunnels: Creates secure tunnels for secure data transfer and communication.
How to Enable SSH on Ubuntu
So, here we will perform how to Enable SSH on Ubuntu there are three major methods to Enable SSH as listed here.
Table of Content
Using OpenSSH Server Package to Enable SSH on Ubuntu
Step 1: Open Terminal
So firstly we have to open our Linux Ubuntu system and open the terminal which interface is look like that.
Step 2: OpenSSH Server is Installed
Now we have to ensure first that or checked that our OpenSSH Server is installed in out Linux system or not using the following command.
sudo apt list openssh-server
Step 3: Install OpenSSH Server
After checked if it’s not installed then you can install using the following command open terminal enter the command and hit enter.
sudo apt update
sudo apt install openssh-server
Step 4: Start and Enable SSH Service
Once it is Installed the SSH server should start successfully if it’s not then using the following command.
sudo service ssh start
To ensure it starts on boot, enable the service with the following:
sudo systemctl enable ssh
Step 5 : Check SSH Status
After enable the SSH server now we have to check the SSH server status to ensure the SSH service are running.
sudo service ssh status
Now SSH is now enabled on your Ubuntu system.
Using SSH Config File to Enable SSH on Ubuntu
Step 1: Open SSH Config File
So now we have to Open the SSH configuration file using a text editor.
sudo nano /etc/ssh/sshd_config
Step 2: Uncomment PermitRootLogin
Locate the line #PermitRootLogin prohibit-password and uncomment it by removing the # at the beginning. then save and exit.
Step 3: Restart SSH Service
Restart the SSH service to apply the changes.
sudo service ssh restart
Using UFW (Uncomplicated Firewall) to Enable SSH on Ubuntu
Step 1: Allow SSH in UFW
If we have a firewall turned on, so we need to allow SSH traffic. If we are using a tool called UFW (Uncomplicated Firewall), we can allow SSH by doing the following command.
sudo ufw allow ssh
Step 2 : Enable UFW
Enable UFW to start at boot.
sudo ufw enable
Step 3: Check UFW Status
Now Verify the status of UFW to confirm that SSH is allowed.
sudo ufw status
Now, as you can see the SSH is enabled, and UFW is configured to allow SSH traffic.
Step 7: Access SSH
Now this is final steps to check the Access of SSH whether it is Enabled or not. using the following command.
Now we can access our Ubuntu machine via SSH using its IP address or hostname-
ssh username@your_ubuntu_ip
Conclusion
So, Overall the enabling SSH on Ubuntu is a straightforward process that involves installing the OpenSSH server package and starting the SSH service. The Secure Shell protocol provides a secure and encrypted means of communication, allowing users to remotely access and manage their Ubuntu machines. This not only facilitates efficient system administration but also contributes to a more robust and secure computing environment. Through the integration of SSH, Ubuntu users can confidently manage their systems with the assurance of a reliable and secure remote connection.