The SSH (Secure Shell) protocol is using to establish a secure connection between the user and the server. In this protocol, all content sent between the user and the server is encrypting using the public key and symmetric encryption, and only two parties with a commonly agreed key can access the original content. In this article, we are going to teach you How to Enable and Disable SSH on AlmaLinux. You can visit the packages available in Eldernode if you wish to purchase a Linux VPS server.
Table of Contents
How to Enable and Disable SSH on AlmaLinux
Introduction to SSH
To create an SSH Connection, the user’s public key (as the connection initiator) must be recognized as an authorized public key on the server. Therefore, when a user sends a request to create an SSH connection to a server, the user’s public key and the correctness of the private key associated with it are checked first. Then a connection is creating. In this case, any system that has a copy of the public and private keys can connect to the server as a similar user.
Apart from this, there are other ways to communicate, one of which is to use a password. When a user is about to connect to a server, it is identified by a unique username and password. This password can be used to connect to the server without exchanging a public key beforehand. If this method is used, automated public and private keys are generated and used for encryption. This method is less secure than the previous method because the attacker can access the password using the MITM attack and use it to connect to the server.
The SSH protocol is an alternative to insecure protocols such as telnet, where all information is sent and received in the form of unencrypted text. The main and most common use of SSH is to connect to a server and execute a command. But because SSH can be used to create a secure channel, it can also be used to copy a file from one system to another securely using SCP or Secure Data Transfer (SFTP). Also, using the created tunnel, part of the traffic can be passed through the server and used as a VPN server.
In the continuation of this article, join us to show you how to Enable and Disable SSH on AlmaLinux.
Enable SSH on AlmaLinux
After getting acquainted with SSH in the previous section, now in this section, we are going to discuss how to Enable SSH on AlmaLinux. To do this, just follow the steps below.
The first step is to install the appropriate OpenSSH package for your system. Note that if you want your computer to accept incoming SSH connections, you must install the OpenSSH-server package. But if you want to start outgoing connections with the ssh command, you need to install the OpenSSH-clients package. You can install both by running the following command:
dnf install openssh-server openssh-clients
The next step is to configure and control the service. The reason for this configuration is that the SSH service can be controlled via system command. You can start or stop the SSH server using the following commands:
systemctl start sshd
systemctl stop sshd
Finally, you can use the following command to enable SSH. Doing so will automatically generate SSH on the system boot:
systemctl enable sshd
Disable SSH on AlmaLinux
In the previous section, you learned how to enable SSH. In this section, we want to teach you how to disable SSH. To do this, simply run the following command:
systemctl disable sshd
You can now check the status of the SSH server by running the following command:
systemctl status sshd
Note: Running the following commands will accept incoming connections via firewalld:
firewall-cmd --zone=public --permanent --add-service=ssh
As explained earlier, the SSH protocol uses cryptography to send information. The SSH protocol can also be called a secure version of the Telnet connection. The SSH protocol is currently available in two versions, SSH-1 and SSH-2, on most operating systems. By default, it is possible to connect through both versions, unless it is configuring on the server-side and in the SSH configuration file, which only supports version 1 or, for example, 2. In this article, we tried to teach you how to Enable and Disable SSH on AlmaLinux.