Enabling SSH login as root user on Red Hat Enterprise Linux 9 (AWS EC2)
login as root user
cd /etc/ssh/sshd_config.d
[root@ip-110.1.1.1.1 sshd_config.d]# ls -lrt
total 8
-rw-------. 1 root root 719 Jan 8 12:31 50-redhat.conf
-rw-------. 1 root root 27 Mar 14 16:19 50-cloud-init.conf
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# vi 50-cloud-init.conf
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-03-14 16:17:41 UTC; 1min 49s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1301 (sshd)
Tasks: 1 (limit: 50306)
Memory: 1.4M
CPU: 39ms
CGroup: /system.slice/sshd.service
└─1301 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal systemd[1]: Starting OpenSSH server daemon...
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal sshd[1301]: Server listening on 0.0.0.0 port 22.
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal sshd[1301]: Server listening on :: port 22.
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal systemd[1]: Started OpenSSH server daemon.
Mar 14 16:17:51 ip-110.1.1.1.1.ec2.internal sshd[1302]: error: Received disconnect from 150.242.66.235 port 9857:14: No supp>
Mar 14 16:17:51 ip-110.1.1.1.1.ec2.internal sshd[1302]: Disconnected from authenticating user oracle 150.242.66.235 port 985>
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl stop sshd
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl status sshd
○ sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: inactive (dead) since Thu 2024-03-14 16:19:45 UTC; 2s ago
Duration: 2min 3.674s
Docs: man:sshd(8)
man:sshd_config(5)
Process: 1301 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 1301 (code=exited, status=0/SUCCESS)
CPU: 41ms
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal systemd[1]: Starting OpenSSH server daemon...
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal sshd[1301]: Server listening on 0.0.0.0 port 22.
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal sshd[1301]: Server listening on :: port 22.
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal systemd[1]: Started OpenSSH server daemon.
Mar 14 16:17:51 ip-110.1.1.1.1.ec2.internal sshd[1302]: error: Received disconnect from 150.242.66.235 port 9857:14: No supp>
Mar 14 16:17:51 ip-110.1.1.1.1.ec2.internal sshd[1302]: Disconnected from authenticating user oracle 150.242.66.235 port 985>
Mar 14 16:19:45 ip-110.1.1.1.1.ec2.internal sshd[1301]: Received signal 15; terminating.
Mar 14 16:19:45 ip-110.1.1.1.1.ec2.internal systemd[1]: Stopping OpenSSH server daemon...
Mar 14 16:19:45 ip-110.1.1.1.1.ec2.internal systemd[1]: sshd.service: Deactivated successfully.
Mar 14 16:19:45 ip-110.1.1.1.1.ec2.internal systemd[1]: Stopped OpenSSH server daemon.
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl start sshd
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-03-14 16:19:58 UTC; 3s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1327 (sshd)
Tasks: 1 (limit: 50306)
Memory: 1.3M
CPU: 11ms
CGroup: /system.slice/sshd.service
└─1327 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
Mar 14 16:19:58 ip-110.1.1.1.1.ec2.internal systemd[1]: Starting OpenSSH server daemon...
Mar 14 16:19:58 ip-110.1.1.1.1.ec2.internal sshd[1327]: Server listening on 0.0.0.0 port 22.
Mar 14 16:19:58 ip-110.1.1.1.1.ec2.internal sshd[1327]: Server listening on :: port 22.
Mar 14 16:19:58 ip-110.1.1.1.1.ec2.internal systemd[1]: Started OpenSSH server daemon.
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#