Categories: Ubuntu

How to Enable and Use SSH on Ubuntu 22.04

SSH is a secure shell network protocol that is used to communicate between the two computers over the internet, one is known as the client machine and the other is known as the host machine. The package of the openSSH can be installed using the default packages of the openssh-server in Ubuntu 22.04. In this write-up, the apt package manager is used to install the SSH server on Ubuntu 22.04.

How to Enable SSH on Ubuntu 22.04

To enable the SSH on the Ubuntu 22.04, we have to install the openssh-server whose package is by default comes in the repository of the Ubuntu 22.04:

Sponsored
$ sudo apt install openssh-server -y

When the installation of the openssh-server is completed, we will use the systemctl command to check its status:

$ sudo systemctl status ssh

The SSH service is in the running state, now we will allow the connection on the SSH port by using the ufw command:

$ sudo ufw allow ssh

To save the changes of ufw, we will enable and reload the ufw:

$ sudo ufw enable && sudo ufw reload

How to connect the computer by using the SSH

To connect any other system through the SSH, first make sure both machines have SSH server installed and enabled. Secondly, you should know the IP address and user name of the machine you want to connect, for example, in our case, the IP address of the machine to which we want to connect is 192.168.1.12 and the hostname is “linuxhint”, we will execute the command:

$ ssh linuxhint@192.168.1.12

Sponsored

For the first time connection, it will confirm you to process, so type “y” and press the ENTER key, and then it will ask for the password:

After providing the correct password, our system is connected to the new machine:

We can list down the contents of the connected system in order to verify:

$ ls

To close the connection with the system connected through SSH, we will run the exit command:

$ exit

Conclusion

SSH is a communication protocol to communicate between two different machines, one is the client and the other is the host. In this write-up, we have installed the OpenSSH server in Ubuntu 22.04 and used it to connect to a remote machine.

Ubuntu Server Admin

Recent Posts

How to Fix VMware’s “Could not open /dev/vmmon” Error on Ubuntu

You’ve recently installed VMware Workstation on your Ubuntu system and encountered the frustrating “Could not…

4 hours ago

How to Fix Ubuntu 404 Errors While Fetching Dependencies

Have you ever found yourself staring at a terminal full of 404 errors while trying…

4 hours ago

How to Fix ‘Please Install All Available Updates’ Error When Upgrading Ubuntu 18.04 to 20.04 LTS

One particularly frustrating error that many users face when trying to upgrade from Ubuntu 18.04 …

4 hours ago

How to fix “Release is not valid yet” Error in Docker Containers

In the world of containerization, time synchronization issues can create unexpected roadblocks when working with…

4 hours ago

How to fix “Externally Managed Environment” Pip Errors on Ubuntu

If you’ve recently upgraded to Ubuntu 23.04 or newer, you might have encountered a frustrating…

4 hours ago

Ubuntu now officially supports NVIDIA Jetson: powering the future of AI at the edge

Canonical announces the General Availability of Ubuntu for the NVIDIA® Jetson Orin™ for edge AI…

11 hours ago