Showing posts with label ILOM. Show all posts
Showing posts with label ILOM. Show all posts

Monday, 8 July 2024

ssh: connect to host port 22: Connection refused

If you're unable to connect to a server via SSH but ILOM is still accessible, you can use the ILOM console to investigate and resolve the issue. Here's a real-time example of troubleshooting SSH connectivity failure.

Issue:

# ssh test_server
ssh: connect to host test_server port 22: Connection refused

However, ILOM (test_server-ilo) was accessible.

1) Connected to ILOM using SSH:

# ssh test_server-ilo
Password:
->

2) Started the console using the following command:

-> start /HOST/console
Are you sure you want to start /HOST/console (y/n)? y
Serial console started. To stop, type ESC (
test_server login: root
Password:
# pwd
/root
# hostname
test_server

3) Checked if SSH service (sshd) was running:

# ps -ef | grep sshd

If SSH is running, you will see output like:

/usr/sbin/sshd -D

In my case, there was no such process — SSH was not running.

4) Started the SSH service:

# systemctl start sshd.service

✅ This resolved the issue.

🛠 Other Possible Causes

1) SSH is running on a different port

Sometimes, SSH is configured to run on a non-default port (not 22).

# grep ^Port /etc/ssh/sshd_config
Port 2222

In such case, connect using:

# ssh -p 2222 test_server

2) SSH service is disabled or masked

If SSH service is disabled or masked, it won’t start automatically on reboot.

# systemctl status sshd.service
# systemctl unmask sshd.service
# systemctl enable sshd.service
# systemctl start sshd.service

3) Firewall is blocking port 22

If port 22 is blocked by the firewall, SSH will be unreachable from the network.

# firewall-cmd --list-all
# firewall-cmd --add-port=22/tcp --permanent
# firewall-cmd --reload

4) sshd binary missing or corrupted

If the sshd binary or its dependencies are missing or corrupted, SSH service may fail to start.

# which sshd
/usr/sbin/sshd

If not found or broken, reinstall the OpenSSH server package:

# yum reinstall openssh-server

5) ssh_keys group missing in /etc/group

Sometimes the ssh_keys group might be missing in the /etc/group file. To check:

# cat /etc/group | grep ssh
sshd:!:74:

If ssh_keys is missing, add the following line to the /etc/group file:

ssh_keys:x:102:

Then restart the SSH service:

# systemctl start sshd.service

📌 Related Reading

Tuesday, 13 June 2023

How to connect to the server from ILOM console -

Sometimes a server becomes inaccessible over the network, but you still need to access it for troubleshooting or to reboot it. In such cases, connecting through the ILOM (Integrated Lights Out Manager) console is a reliable and commonly used method by DBAs and system administrators.

For example, the server name is test_server and its ILOM is test_server-ilo.

Steps:

  1. Connect to the ILOM CLI
ssh test_server-ilo
Password:
->
  1. Start the console using the below command. It will ask for the OS username and password.
-> start /HOST/console
Are you sure you want to start /HOST/console (y/n)? y
Serial console started. To stop, type ESC (
test_server login: root
Password:
# pwd
/root
# hostname
test_server
# 

Note: Ensure you have ILOM network access and valid credentials before trying these steps. The ILOM console is especially useful when the server OS is not reachable by SSH.

Linux Manuals

📚 Other Helpful Guides