How to enable SSH on Almalinux

SSH is the primary method of remote access and administration on Linux systems. SSH is a client-server service providing secure, encrypted connections over a network connection. After installing AlmaLinux or migrating from CentOS to AlmaLinux, it will probably be one of the first things you want to configure.

In this guide, we’ll go over the step by step instructions to install and configure SSH on AlmaLinux. This will help you whether you just want to connect to remote systems via SSH or you want your own system to accept incoming connections as well.

In this tutorial you will learn:

  • How to install SSH
  • How to start and stop the SSH service
  • How to allow SSH through system firewall
SSH server enabled and running on AlmaLinux

SSH server enabled and running on AlmaLinux

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System AlmaLinux
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

How to enable SSH on AlmaLinux

Follow the step by step instructions below to get SSH installed on your system and use it to initiate remote connections or accept incoming connections.

  1. Install the appropriate OpenSSH package for your system. The openssh-server package will need installed if you’d like your computer to accept incoming SSH connections. Otherwise, if you’d just like to initiate outgoing connections with the ssh command, then you can install the openssh-clients package. Of course, you may also install both.
    # dnf install openssh-server openssh-clients
    
  2. The SSH service can be controlled through systemd. Use the following systemctl commands to configure and control the service.

    To start or stop the SSH server:

    # systemctl start sshd
    AND
    # systemctl stop sshd
    


    To enable (make SSH start automatically at system boot), or disable the SSH server:

    # systemctl enable sshd
    AND
    # systemctl disable sshd
    
  3. Check whether the SSH server is running by using the systemctl status command.
    # systemctl status sshd
    
  4. The sshd status indicates that the service is currently running

    The sshd status indicates that the service is currently running

  5. In order to accept incoming connections, you’ll need to allow the service through firewalld by executing the following commands.
    # firewall-cmd --zone=public --permanent --add-service=ssh
    # firewall-cmd --reload
    

That’s all there is to it. For an in-depth look at additional configuration of OpenSSH, check out our dedicated guide for making the most out of OpenSSH.

Closing Thoughts

In this guide, we saw how to enable SSH on AlmaLinux. This included installing the OpenSSH client and server packages, and configuring our system to accept incoming connections. SSH is an essential protocol for most Linux systems, as it allows you to open remote terminals to any number of systems, or to manage your own system from over the internet.