How to install and configure OpenSSH on Ubuntu 18.04?

OpenSSH is a widely-used and powerful tool for remote access and secure file transfers. It is a secure replacement for the outdated Telnet and FTP protocols. In this tutorial, we’ll show you how to install and configure OpenSSH on Ubuntu 18.04, follow these steps.

Step 1: Update the system

Open the terminal on your Ubuntu machine and run the following commands.

sudo apt update

sudo apt upgrade

This will update the package list and upgrade the existing packages.

Step 2: Install OpenSSH

OpenSSH is available in the official Ubuntu repository, so you can easily install it using the apt command

sudo apt install openssh-server

The command will download and install the OpenSSH package and its dependencies.

You can verify that the installation was successful by running the following command.

systemctl status sshd

The output should show that the service is active and running.

Step 3: Configure OpenSSH

The OpenSSH configuration file is located at /etc/ssh/sshd_config.

Before making any changes, make a backup of the original file:

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig

Edit the configuration file using your favorite text editor.

sudo nano /etc/ssh/sshd_config

You can make changes such as enabling password authentication, changing the default SSH port, and so on.

Save the changes and exit the text editor.

Step 4: Restart the SSH service

To apply the changes, restart the SSH service.

sudo systemctl restart sshd

Step 5: Test the SSH connection

Test the SSH connection from another machine by opening a terminal or command prompt and running the following command:

ssh user@ip_address

Replace user with your username and ip_address with the IP address of the Ubuntu machine.

If you’re connecting for the first time, you may see a warning message about the authenticity of the host. Type yes to continue the connection.

If everything is working properly, you should see the Ubuntu command prompt.

Conclusion

By following these steps, you can easily install and configure OpenSSH on Ubuntu 18.04.

OpenSSH is a powerful tool for remote access and file transfers, and it’s essential for any server or workstation.


How to install and configure OpenSSH on Ubuntu 20.04?

Comments

Popular posts from this blog

How to update build number in Azure DevOps pipeline?

How to get latest build ID from Azure DevOps pipeline?

How to install AWS System Manager (SSM) Agent on windows using PowerShell?