How to install, start and connect to SSH Server on Fedora Linux

The tutorial will explain the basics behind SSH server and SSH client connections on Fedora Linux Workstation. By default the SSH server on Fedora Workstation may be installed but not enabled. This will cause a following error message when connecting via SSH client:

ssh: connect to host fedora-workstation port 22: Connection refused

In this tutorial you will learn:

  • How to Install SSH server
  • How to enable SSH server
  • How to Start SSH server
  • How to Connect to SSH server

Check status, enable and start the SSH Server on Fedora Linux

Check status, enable and start the SSH Server on Fedora Linux

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Fedora 30
Software OpenSSH
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Enable and start SSH server on Fedora Workstation step by step instructions

  1. First step is to check whether the openssh-server is installed on your Fedora system. To do so execute the following command which in case the SSH server is install should produce a relevant output. Example:
    $ rpm -qa | grep openssh-server
    openssh-server-7.9p1-5.fc30.x86_64
    

    In case the above command did not produced any output use the dnf command install package openssh-server:

    $ sudo dnf install openssh-server
    
  2. Next step is to enable systemd service sshd to make sure that SSH daemon will start after the reboot:
    $ sudo systemctl enable sshd
    
  3. Once the SSHD service is enable use once again the systemclt command to start SSH server:
    $ sudo systemctl start sshd
    

    Once ready check the SSH server status using the following command:

    $ sudo systemctl status sshd
    

    Furthermore, you should now see the port 22 open for a new incoming connections:

    $ sudo ss -lt
    
    Check for SSH server opened port 22 using ss command.

    Check for SSH server opened port 22 using ss command.

    NOTE
    In case you are running a firewall you might need to first open the SSH port. Otherwise your incoming SSH connection will be refused.
  4. Now, we are ready to connect to the SSH server on the Fedora Workstation system. Example:
    $ ssh username@fedora-ip-or-hostname