SSH or Secure Shell is a simple networking protocol that enables secure data communication. It allows safe remote shell services, command execution and ensures security between two connected devices. These devices can be connected over a secured or an unsecured network running SSH client programs. Generally, SSH enables users to remotely connect to a server. Port 22 is the standard port for SSH, however, users can transfer files through SFTP (SSH File Transfer Protocol/Secure File Transfer Protocol) or SCP (Secure Copy).
Enabling SSH doesn’t require in-depth technical knowledge, so you should be able to do it easily by following a bunch of steps. In this tutorial, we’ll cover the reasons you should enable SSH access and learn how to enable SSH on Ubuntu.
5 Reasons to Enable SSH:
- SSH allows you to monitor your log-files in real-time
- SSH deters attackers from misusing IP source routing, i.e. SSH ensures the security of the information in the IP header travelling between the source and destination path.
- It helps avoid DNS spoofing, otherwise known as DNS cache poisoning attack
- It encrypts data and helps in keeping malicious viruses and hackers away
- It helps protect your data from eavesdropping and sniffing attacks
How to Enable SSH on Ubuntu
Having seen what SSH is and the reasons to enable SSH on your server, let us now move on to understanding how to enable SSH on Ubuntu.
Enabling SSH in Ubuntu helps provide remote access login with other network communication channels. It is a 2-step process:
- Installing the server:
- Open ‘Terminal’ using the Ctrl+Alt+T shortcut on your keyboard or clicking on the ‘Terminal’ icon
- To install, run the commands
sudo apt update
sudo apt-get install open ssh-server
- The server starts automatically post-installation of the SSH server. To check whether SSH is installed properly, run the following command
sudo systemctl status ssh
- Configuring SSH:
- Changing your default port number to another is an important step when configuring SSH
- To update your SSH port, open the SSH configuration file by running the following command.
sudo apt-get install nano -y // to install the ‘nano’ editor. You can use any editor of your choice
sudo nano /etc/ssh/sshd_config
- After the config file opens, find the following words # Port 22, where 22 is the default port number
- Change the port number to anything of your choice. However, make sure the port number doesn’t clash with any other port
- Press Ctrl+O to save the changes made and then press Ctrl+X to exit the editor
- Restart SSH after a few seconds and run the following command:
sudo service ssh restart
And we’re done configuring SSH on our Ubuntu server!
Enabling it on your Linux Shared Hosting Package:
We, at HostGator, support SSH access on our Linux Shared Hosting Servers. SSH connection to HostGator‘s Linux Hosting Servers can be through key or password-based authentication. You can follow the below step for password-based authentication in the terminal.
- Run the following command:
ssh -l user remote-server
- Enter the cPanel password.
And you’re good to go! If you wish to connect to your SSH from your cPanel i.e. key-based authentication, you can follow the steps listed here.
We hope you understood how to enable SSH on Ubuntu and found this tutorial helpful. It is easy to install SSH all you need to do is follow the steps in the correct manner. If you have any comments, please feel free to leave them in the comments section below!