業務用エアコン関連の技術情報、エラーコード、環境問題対策に関する別サイト「エアコンの安全な修理・適切なフロン回収」

OracleLinux9.8 : SSH Remote connection , Firewalld , NTP Server

1.Setting up a remote connection via SSH

SSH is a service for connecting remotely to a server and is basically running immediately after the OS is installed, but the default settings are somewhat insecure.
Here we will configure 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".

# vi /etc/ssh/sshd_config

Line 22 : Addition (This time, we'll proceed by changing it to "Port 2244")
#Port 22
Port 2244

Line 24 : Uncomment
ListenAddress 0.0.0.0

Line 41 : Disable Comments (Login as root not allowed)
PermitRootLogin prohibit-password

Restart 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 Oracle, the firewall is firewalld configured by default and enabled during OS installation.

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

# firewall-cmd --state
running

View default zone settings

# firewall-cmd --list-all

public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens160
  sources: 
  services: cockpit dhcpv6-client ssh
  ports: 
  protocols: 
  forward: yes
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks:
  rich rules:

In the above example, we can see that the services "cockpit", "dhcpv6-client", "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, you must use the "--permanent" option.
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 use "fiewall-cmd --reload" to reflect the setting.
As an example, to use the HTTP service permanently without initialization even if the system is rebooted

# 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.

Start 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

# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens160
  sources:
  services: cockpit dhcpv6-client ssh
  ports: 2244/tcp
  protocols:
  forward: yes
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

2244 ports have been added

3.Remote connection from Windows

How to connect using Tabby Terminal
Specify the SSH port number changed with the" -p 2244" option.

C:\Users\xxxxx>ssh huong@192.168.11.83 -p 2244

huong@192.168.11.83's password:
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Wed Aug 19 12:12:59 2026 from 192.168.11.14
[huong@Lepard ~]$

4.NTP Server

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

Chrony Installation and Configuration

# dnf -y install chrony
# vi /etc/chrony.conf
Line 3 : Comment it out and add it below.
#pool 2.pool.ntp.org iburst
pool ntp.nict.jp iburst

Enable chrony and restart.

# systemctl enable chronyd.service
# systemctl restart chronyd.service

NTP port allowed in firewall

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

Check chronyd status (behavior)

# chronyc sources

MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^- ntp-b2.nict.go.jp             1   6    17    46   +466us[ +466us] +/- 4995us
^* ntp-b3.nict.go.jp             1   6    17    47   +184us[+1495us] +/- 5514us
^- ntp-a3.nict.go.jp             1   6    17    46  -1749us[-1749us] +/- 7369us
^- ntp-k1.nict.jp                1   6    17    45  -4011us[-4011us] +/- 7973us

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