Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".(Japanese Version)

CentOS7.9 ; SSH , Fierwalld , NTP

1.Remote connection by SSH

SSH is a service for connecting remotely to a server, basically running immediately after OS installation, but the default settings are somewhat insecure.
Here you can change the default settings to increase the security of ssh connections.

1.1 SSH service configuration file changes

The SSH service configuration file is "/etc/ssh/sshd_config".

Line 17 "Port 22" This time change to "Port 2244" and proceed
Delete the "#" in line 20 "#ListenAddress 0.0.0.0"
Change "PermitRootLogin yes" to "PermitRootLogin no" on line 39.
The root user can log in to the server with administrator privileges if the user name is already known and the password is known, so the settings are set to deny this.

SSH restart

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.How to set up a firewall (firewalld)

To briefly explain "firewalld," when setting communication control policies, communication permission/blocking rules are applied to predefined zones, and these zones are then assigned to each NIC (network adapter).

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

1)Command to check the status and settings of "firewalld"

①Check firewalld operation status

OR

➁View default zone settings

In the above example, we can see that the services "dhcpv6-client" and "ssh" are allowed, etc.

③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, the setting is not reflected in "firewalld" as it is, so it is necessary to reflect the setting by "fiewall-cmd --reload".

As an example, to use the HTTP service permanently without initialization even if the system is rebooted

How to start/stop

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

2.2  Release modified SSH port 2244

2244 ports have been added

3.Remote connection from Windows

Configuration in Windows

Start the setup for remote connection from Windows, using "Tera Term" as the terminal emulator.
Start Tera Term, cancel the startup screen, and then select "New Connection" from "File" in the Tera Term menu.

Enter your own settings in the "Server IP Address" and "TCP Port Number" fields. Finally, click "OK.

After clicking "OK," click "Continue" on the security confirmation screen.

Enter "User name" "Passphrase" and click "OK".

If the information is correct, you should be able to log in normally as shown below.

4.NTP Server Settings

Build an NTP server to synchronize the server time with Japan Standard Time

①Chrony Installation and Configuration

②Restart chrony and enable chrony after system reboot
③NTP port release in firewall
④Check chronyd status (operation)

If it is marked with *, it has been synchronized.

Copied title and URL