How to install and start an SSH server in Fedora 36

Once you have installed the Fedora system on your VirtualBox or hardware, there may be a possibility you will access your system remotely through the SSH service, and when you try to access it, you may find the error “ssh: connect to host port 22: No route to host.”

And when you try to check the status of the SSH service in your Fedora, you may get another error: “Unit ssh.service could not be found.”

If you are also facing a similar kind of issue or you want to install an OpenSSH server on Fedora, then this article can be helpful to fix the above issue.

Step 1: Install an OpenSSH server on Fedora 36

As far as I know, you will find the OpenSSH server preinstalled on your Fedora machine. To get a better idea of whether it is available or not, run the below command, which will print the OpenSSH server version.

$ rpm -iq openssh-server 

If you get the output with the OpenSSH version, then you are good to go ahead and enable the SSH service from the next section.

And for those who get the output “OpenSSH version is not installed,” type the below code to start the installation.

$ sudo dnf install openssh-server

Once the installation is complete, move to the next part to enable the SSH service

Step 2: Enable the OpenSSH server on Fedora 36

The very first step to resolving the above error is to enable the SSH service on your Fedora system, and you will probably get the above error when you try to start the SSH service.

This error is common among newcomers who have recently switched from Ubuntu to Fedora. In Ubuntu, when you invoke the below command to start or check the status on your terminal, it gets accepted because the ssh unit service is available and it is mapped to the default sshd.unit service.

$ sudo systemctl status sshd
$ sudo systemctl start sshd

And this is not the same case with Fedora. You have to invoke the proper command to enable, start, or stop the SSH service.

To check the SSH service status in Fedora, run the below command:

$ sudo systemctl status sshd

The output of the above command cleared out the error and showed the current status of the OpenSSH service, which is “inactive”.

Check ssh service status in Fedora
Check ssh service status in Fedora

Now you can change the status to “active”. Before that, enable the sshd service to automatically restart the SSH service after every boot.

$ sudo systemctl enable sshd

Step 3: Start the OpenSSH server on Fedora 36

Once you are done with the above step, you can start the SSH service to connect with the remote host system.

Run the below code to start the SSH service to connect with the remote system.

$ sudo systemctl start sshd

After that, once again, check the current status of the SSH service.

$ sudo systemctl status sshd

Try to connect your Fedora machine

Once the above changes have been successfully implemented, you can try to connect back to your Fedora system from a remote system.

$ ssh [email protected]
Connect your remote Fedora machine
Connect your remote Fedora machine

If the firewall is implemented on your system, then run the following line to your Fedora system to accept incoming SSH connections through the firewall connection, and then try to connect to your Fedora system. 

# firewall-cmd --zone=public --permanent --add-service=ssh
# firewall-cmd --reload

That’s all to install and start the SSH server in Fedora. You can follow these same steps in other RHEL-based distributions.

In this particular article, you have learned the following:

  • How to install an SSH server
  • How to start an SSH server in Fedora
  • How to check SSH service status in Fedora.

Bye Bye!

This Post Has 2 Comments

  1. sasha

    Hi, i did as it’s explained. i’ve got two laptops, one on fedora36 another on fedora 21, i can connect/login ssh in terminal from f21 to f36, but if i try to login from f36 to f21 it says Connection reset by port 22. Could you advise what’s wrong with me?

    1. Gagan Mishra

      Hey, First of all, what mechanism do you use to access Fedora 36 to F21, a simple password or a keygen, and second, did you check the firewall rules?

Leave a Reply

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.