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

OracleLinux10.2 : 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 21 "Port 22" this time change to "Port 2244" and proceed
Port 2244

Line 23 : Uncomment
ListenAddress 0.0.0.0

Line 40 : Uncomment
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.

Check firewalld operation status

# firewall-cmd --state
running

View default zone settings

# firewall-cmd --list-all
public (default, active)
  target: default
  ingress-priority: 0
  egress-priority: 0
  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

⑤Release modified SSH port 2244

# firewall-cmd --add-port=2244/tcp --permanent
# firewall-cmd --reload
# firewall-cmd --list-all
public (default, active)
  target: default
  ingress-priority: 0
  egress-priority: 0
  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: [User huong's password]
Web console: https://localhost:9090/ or https://192.168.11.30:9090/ Last login: Fri Jul 17 08:53:52 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 below it.
#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    54   +260us[ +260us] +/- 5805us
^* ntp-b3.nict.go.jp             1   6    17    55   -497us[ -564us] +/- 6054us
^- ntp-a3.nict.go.jp             1   6    17    54  -1734us[-1734us] +/- 7237us
^- ntp-k1.nict.jp                1   6    17    53   +394us[ +394us] +/- 3195us

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