Overview

XShell is a widely used remote server management tool. But what should you do when Xshell fails to connect? Here are several troubleshooting strategies.

1. Check the port

Check the Port configuration in /etc/ssh/sshd_config (e.g., Port 2222). If the port has been changed, you need to update it accordingly in Xshell.

2. Firewall rules
iptables -L -n | grep 22      # iptables
firewall-cmd --list-ports     # firewalld (CentOS/RHEL)
ufw status                    # Ubuntu (UFW)

Check whether the firewall has allowed the port.
firewall-cmd --add-port=22/tcp --permanent
firewall-cmd --reload

If the port is not allowed, you need to add it.

3. Verify the username

Check whether the server username is correct. Sometimes it is not the root username.