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
|Category||Requirements, Conventions or Software Version Used|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – 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.
- Install the appropriate OpenSSH package for your system. The
openssh-serverpackage 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
sshcommand, then you can install the
openssh-clientspackage. Of course, you may also install both.
# dnf install openssh-server openssh-clients
- The SSH service can be controlled through systemd. Use the following
systemctlcommands 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
- Check whether the SSH server is running by using the
# systemctl status sshd
- 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.
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.