How to Enable Secure Shell (SSH) on Ubuntu Linux
You want to do everything in your power to ensure that the client-server connections you make are secure. That is why you should consider enabling SSH on Ubuntu. It is a network protocol known as Secure Shell that should keep the highest level of security for making this type of connections. In this guide, we are investigating how to enable SSH on Ubuntu.
What You Need to Know Before Enabling SSH on Ubuntu
Only the users with root account or super-user permission can perform the commands mentioned in this article. Make sure that you have the required permissions or log in as the root user.
How to Enable SSH on Ubuntu
Although SSH does not come pre-installed with Ubuntu, you can find the installation in the official repository.
Open your terminal and type in the following commands to start the installation:
apt-get update apt-get install openssh-server
You may be asked to enter the account password to approve the installation.
If you want to confirm that SSH service was installed correctly, run the following command:
systemctl status ssh
The service will automatically start as soon as you install it, which means that the system should display a message that SSH is running (is active).
Once the installation has completed, you can use any other remote machine to connect to your system. Linux and MacOS have default SSH clients, but if you are using Windows, you will need to download and install an SSH client.
Use LAN to Connect to SSH
If you want to use the local area network (LAN) to connect to your system, use this line:
Change the “account_name” to your username and the numbers with the IP address of the system using the SSH service.
You can easily find out your IP address with the following command:
Once you enter the requested details, the system will go ahead and make the connection via SSH. It will ask you whether you want to continue connecting. Go ahead and type “y” to confirm. When the system asks for the password, enter the access code, too.
If you successfully make the connection, the system will send you a welcome message.
Use the Internet to Connect to SSH
The alternative to using LA is to use the internet. However, keep in mind that this requires knowledge of the public IP address of your system. Additionally, you should set the port 22 of your router to accept data and send it to your SSH-running Ubuntu device.
You can easily find the public IP address of the machine you want to connect to by heading to https://ipconfig.co/ip.
The problem might be to set your router properly for port forwarding. Since each router is different, you should check out the official instructions or consult the manufacturer. Your goal is to set the port number for making requests to 22 and enter the private IP of the machine you want to connect to. The reason why you are using port 22 is because that is the default SSH port.
As we mentioned, you can use the following command on your SSH-running system to obtain its private IP address:
When you complete the setup process of your router, the logging in part is pretty simple. Start by entering this command:
How to Disable SSH on Ubuntu
If you estimate that there is no need to use SSH on your Linux-based system anymore, you can disable it. The command for doing so looks like this:
systemctl stop ssh
Keep in mind that this will only disable the service. If you want to run SSH again, type:
systemctl start ssh
You will need the super-user permission for both of these commands.
If you do not want SSH to start when you boot your system, use the following line:
systemctl disable ssh
If you want it to start together with your system, type the following:
systemctl enable ssh
Using the SSH service is a vital security measure when using remove machines to connect to your system. The process of enabling SSH on Ubuntu is fairly simple and doesn’t take a long time.
When it comes to additional options, those that often connect to the system might consider a key-based authentication to connect via SSH. That will save you from typing the password every time you want to make the connection. You can also use the SSH configuration file to manage multiple systems, but that is also an advanced utility.
In this guide, we focused on the basics to teach you how to enable SSH on Ubuntu to make secure connections with a remote server.
If you are a fan of using Python programming language, you can make your life easier by using Python Pip. It is a package management utility that allows you to install and manage Python software packages easily. Ubuntu doesn’t come with pre-installed Pip, but here…
If you are looking for a convenient way to manage Java applications on Ubuntu, the solution may lie in the IntelliJ IDEA development platform. An excellent advantage of this option is that it is relatively suitable for beginners, but experienced users will also find it…