Fedora45 : SSH 、Firewalld

1.Configuring Remote Connections via SSH

Configure the default settings to increase the security of ssh connections.

1.1 Modifying the SSH Service Configuration File

To change the SSH service settings, edit the configuration file "/etc/ssh/sshd_config".

# vi /etc/ssh/sshd_config

Line 21, "Port 22" This time change to "Port 2244" and proceed.
Port 2244

Line 23 : Uncomment
ListenAddress 0.0.0.0

Line 41 : Uncomment and refuse to log in to the server with administrator privileges
PermitRootLogin prohibit-password

Restarting SSH

# systemctl restart sshd.service

If this is not done, the next time you reboot, you will not be able to connect remotely via SSH. Please free SSH port 2244 in the following firewall settings.

2.Firewall (firewalld) settings

In Fedora, firewalld is set as the default firewall and is enabled during OS installation.

2.1 How to use the "firewall-cmd" command to control "firewalld"

①Check firewalld operation status

# firewall-cmd --state

If "firewalld" is running, the message "running" will be displayed; if it is not running, the message "not running" will be displayed.

➁About the "--permanent" option
To prevent the settings from disappearing when the server is restarted or the "firewalld" service is restarted, the
The "--permanent" option must be used to configure the settings.
If the "--permanent" option is specified, it is necessary to use "fiewall-cmd --reload" to reflect the settings, as they are not reflected in "firewalld" as they are.

Permanent use of HTTP service without initialization after system reboot

# firewall-cmd --add-service=http --permanent
# firewall-cmd --reload

➂How to start/stop
Since "firewalld" is controlled by "systemd", use the "systemctl" command to start and stop it.

Starting firewalld
# systemctl start firewalld
Stopping firewalld
# systemctl stop firewalld

2.2  Release modified SSH port 2244

# firewall-cmd --add-port=2244/tcp --permanent
# firewall-cmd --reload

3.Remote connection from Windows

Connect using the Tabby Terminal terminal emulator from Windows.
Specify the SSH port with the [-p 2244] option.

Clink v1.7.6.d9907d
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2024 Christopher Antos
https://github.com/chrisant996/clink

C:\Users\xxxxx>ssh huong@192.168.11.83 -p 2244
huong@192.168.11.83's password: ←User password
Web console: https://Lepard:9090/ or https://192.168.11.83:9090/
huong@Lepard:~$