Hello Linux specialists. I have a small problem. On the remote machine in the ssh settings I uncommented and changed one parameter ListenAddress. I registered the local address of the ssh (192.168.100.10). The port remained as before 22. After rebooting I could not connect via SSH. Until I disabled SELINUX on the remote machine and everything worked. But I do not want to disable SELINUX on the remote machine. What rule should I specify for SELINUX so that both SSH and SELINUX work? Thanks.
It would have been better to check the logs first, before disable selinux, in order to see what it’s complaining about.
Jul 30 18:51:07 srv sshd[885]: error: Bind to port 22 on 192.168.100.10 failed: Cannot assign requested address.
Jul 30 18:51:07 srv sshd[885]: fatal: Cannot bind any address.
Jul 30 18:51:09 srv polkitd[1196]: Loading rules from directory /etc/polkit-1/rules.d
Jul 30 18:51:09 srv polkitd[1196]: Loading rules from directory /usr/share/polkit-1/rules.d
Jul 30 18:51:09 srv polkitd[1196]: Finished loading, compiling and executing 3 rules
Jul 30 18:51:09 srv polkitd[1196]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
Jul 30 18:51:49 srv sshd[2770]: Server listening on 192.168.100.10 port 22.
Jul 30 18:51:54 srv systemd[2780]: pam_unix(systemd-user:session): session opened for user tommy by (uid=0)
Jul 30 18:51:54 srv cockpit-session[2771]: pam_unix(cockpit:session): session opened for user tommy by (uid=0)
Jul 30 18:51:55 srv polkitd[1196]: Registered Authentication Agent for unix-session:1 (system bus name :1.31 [cockpit-bridge], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale C.UTF-8)
Jul 30 18:51:55 srv sudo[2796]: tommy : PWD=/run/user/1048 ; USER=root ; COMMAND=/bin/cockpit-bridge --privileged
Jul 30 18:51:55 srv sudo[2796]: pam_unix(sudo:session): session opened for user root by (uid=1048)
Jul 30 18:52:20 srv sshd[5658]: Accepted password for tommy from 192.168.100.13 port 58659 ssh2
Jul 30 18:52:20 srv sshd[5658]: pam_unix(sshd:session): session opened for user tommy by (uid=0)
This is the log file ssh.log there is a lot of stuff there, but this excerpt fits the time. I connected to SSH (unsuccessfully) then I connected to COCKPIT and disabled SELINUX and successfully connected to SSH.
Ok, it might be related to selinux, or it might be related to rebooting (and not waiting long enough for the network to come online). Restart sshd once the network is online.
Try re-enable selinux, and see if the error comes back.
If it was selinux, please try to provide some more logs. You can execute ausearch -i -ts 07/30/2025 18:50:00 -te 07/30/2025 18:53:00
and paste the output.
[tommy@srv]$ sudo ausearch -i -ts 07/30/2025 18:50:00 -te 07/30/2025 18:53:00
Error parsing start date (07/30/2025)
[tommy@srv]$ sudo ausearch -i -ts 2025/07/30 18:50:00 -te 2025/07/30 18:53:00
Invalid start date (2025/07/30). Month, Day, and Year are required.
[tommy@srv]$ sudo ausearch -i -ts 07.30.2025 18:50:00 -te 07.30.2025 18:53:00
Invalid start date (07.30.2025). Month, Day, and Year are required.
[tommy@srv]$ sudo ausearch -i -ts 07,30,2025 18:50:00 -te 07,30,2025 18:53:00
Invalid start date (07,30,2025). Month, Day, and Year are required.
[tommy@srv]$ sudo ausearch -i -ts 07-30-2025 18:50:00 -te 07-30-2025 18:53:00
Invalid start date (07-30-2025). Month, Day, and Year are required.
[tommy@srv]$
Probably some package is missing? It doesn’t work.
Try sudo LC_TIME=en_US.UTF-8 ausearch -i -ts 07/30/2025 18:50:00 -te 07/30/2025 18:53:00
Works on my RL9. What Rocky version are you on? If that fails maybe sudo ausearch -i -c sshd
After reboot (rebooting the entire server), oddly enough, everything works, but errors appeared in COCKPIT. But everything works
and COCKPIT is enabled and SSH works (I can connect).
Thanks everyone, I found the problem. I specified the IP addresses incorrectly, I have two interfaces. I’m a fool.