Server in Linux Installing and Configuring an SSH

1. Installing OpenSSH

Open the terminal and run the following command to install the OpenSSH server:

Ubuntu/Debian:

sudo apt update && sudo apt install openssh-server -y

CentOS/RHEL:

sudo yum install openssh-server -y

Arch Linux:

sudo pacman -S openssh

2. Configuring SSH

Open the SSH configuration file:

sudo vim /etc/ssh/sshd_config

Change the Port parameter to a custom one, for example 2211 or 2233.

Disable root login:

PermitRootLogin no

Enable public key authentication:

PubkeyAuthentication yes

It’s also important to disable password authentication:

PasswordAuthentication no

Disallow empty passwords:

PermitEmptyPasswords no

To apply the changes, restart the SSH server:

sudo systemctl restart sshd

🚀 Explore more guides on our blog 👉 blog.1it.pro
📧 Contact us: admin@1it.pro for expert IT guidance.
🌐 Explore more: Visit 1it.pro for top-tier IT solutions.

UA EN RU

Зв'язатися з нами

Telegram Email