Support > About cloud server > Locked Out of Your Server? A Guide to Recovering Access After Losing SSH/RDP Connectivity—Including Out-of-Band Rescue via VNC
Locked Out of Your Server? A Guide to Recovering Access After Losing SSH/RDP Connectivity—Including Out-of-Band Rescue via VNC
Time : 2026-11-15 10:32:48
Edit : Jtti

In server operations and maintenance, there is a scenario guaranteed to send your blood pressure soaring: you modify an SSH configuration file or adjust firewall rules, hit "Enter," restart the service—and suddenly, your terminal freezes. You attempt to reconnect, only to realize with a sinking feeling that you are completely locked out.

Whether it’s an incorrect password, a blocked port, or a broken service configuration, the result is the same: you are shut out of the server you manage.

Restarting the server won’t help, as you have no way to issue commands. Your only lifeline is the VNC (out-of-band management console) provided by your cloud platform. In this guide, we will break down the four primary causes of server "disconnection," explain how to use the VNC channel for emergency recovery, and outline best practices to prevent such issues from happening in the first place.

What is VNC Out-of-Band Recovery?

Standard SSH or RDP connections rely on the operating system’s network services (such as `sshd` or `TermService`) and the proper functioning of the server’s network interface. If any of these fail, the server becomes unreachable over the network.

VNC (Virtual Network Computing) is an "out-of-band management" technology. It does not depend on any network services running within the operating system; instead, it connects directly to the cloud platform’s virtualization layer (the hypervisor). It is effectively the same as plugging a physical monitor and keyboard directly into a server in a data center. As long as the server is powered on, VNC allows you to view the screen and input commands, enabling you to fix network or configuration issues from within the system.

Four Common Causes of Disconnection and How to Recover via VNC

Log in to your cloud console, locate the VNC/Web terminal access point for the affected instance, and—once you have reached the system command line—apply the appropriate fix based on the scenario below:

Cause 1: Accidental Blocking by Firewall/Security Groups (Most Frequent)

Often, a simple change to an `iptables` rule or a `ufw` policy can inadvertently block port 22 (SSH).

Recovery (Linux): Log in via the VNC console using your credentials, then run `ufw disable` (on Ubuntu) or `systemctl stop firewalld` (on CentOS) to temporarily disable the system firewall. If you are using `iptables`, run `iptables -F` to flush the existing rules.

Note: Also, be sure to check the security group rules in your Jtti console via VNC to confirm that port 22 (or your custom SSH port) is set to "allow."

Culprit 2: Incorrect SSH configuration or port conflicts

If you have entered incorrect parameters in `/etc/ssh/sshd_config`—such as a missing space or an invalid port number—the `sshd` service will crash immediately upon restart.

Troubleshooting: Log in via VNC and run the command `sshd -t`. If there is an error, the command will point out exactly which line contains the mistake. Use `vim` to fix the error, then run `systemctl restart sshd`.

If you have changed the SSH port: First, use `ss -tlnp | grep sshd` to verify which port the service is actually listening on. Then, update your console's security group rules to allow that port, and attempt to connect using the new port.

Culprit 3: System resource exhaustion causing a "freeze"

If the server experiences an OOM (Out of Memory) event or the disk reaches 100% capacity, the `sshd` process will be unable to create new sessions, resulting in connection timeouts.

Troubleshooting: Via VNC, use `df -h` to check disk space, and `free -h` or `top` to check memory usage. If the disk is full, clear out log files (e.g., `rm -rf /var/log/*.gz`). If memory is exhausted, terminate the problematic processes using `kill -9 <PID>`.

Culprit 4: "Ruthless" intervention by SELinux

On CentOS/RHEL systems, if you change the SSH port without informing SELinux, SELinux will block the service from binding to the new port. This makes it appear as though the service has started, while in reality, it remains inaccessible.

Troubleshooting: After logging in via VNC, run `semanage port -a -t ssh_port_t -p tcp <your_new_port>` to authorize the new port, or temporarily set SELinux to permissive mode by running `setenforce 0`. Prevention is Better Than Cure: Never Cut Off Your Own Escape Route

The highest level of troubleshooting is the kind that never becomes necessary. When making any changes that could affect connectivity, you must adhere to these ironclad safety rules:

Maintain Both Old and New Ports: When changing your SSH port, keep both the old port (e.g., 22) and the new port (e.g., 2222) in your configuration file. After restarting the service, open a new terminal window and attempt to connect via the new port (2222). Only once you have confirmed a successful connection should you remove the old port (22) from the configuration and restart the service again.

Keep Your Current Session Active: Perform all configuration changes within your existing, active terminal window. As long as this session remains open, you can always use commands like `cp` to restore a backup of your configuration file and restart the service, effectively "rescuing" your access.

Never Disable Firewalls Entirely: Even if you need to disable a system-level firewall (such as `ufw`) for debugging purposes, never disable the security groups managed by your cloud platform.

Why Choose Jtti to Make Connectivity More Predictable?

Beyond configuration errors, "connection failures" are often caused by instability in the underlying network path. If you are using a budget-tier, oversold VPS—or one with highly congested network routes—random packet loss during peak evening hours might lead you to mistakenly believe the server is unreachable. In such cases, repeatedly altering your configuration will likely only cause further damage to your system.

This is where Jtti provides a safety net for your operations:

Stable, Low-Latency CN2 GIA Network: Jtti’s entire product line utilizes premium CN2 GIA direct-access routes across all major carriers. Even if you are modifying network configurations during peak hours, the exceptionally low packet loss ensures that your SSH connection won't time out due to network retransmissions. If you encounter an error, you can be confident it is a genuine configuration issue, not some inexplicable network glitch.

Always-Available VNC Access: The Jtti console provides a VNC channel based on out-of-band management. No matter how strictly you’ve locked down your firewalls, as long as the system is powered on, VNC remains your ultimate fail-safe gateway. High-Speed ​​NVMe Storage and KVM Isolation: When you need to urgently edit files or restart services via VNC, the standard-issue NVMe SSDs ensure rapid system responsiveness—sparing you from frustrating lag while you’re troubleshooting under pressure. Furthermore, KVM-based hardware-level isolation prevents your VNC terminal from freezing due to resource-intensive tasks running on neighboring virtual machines.

Consistent Renewal Pricing for Long-Term Peace of Mind: Jtti adheres to a "same-price renewal" policy. Troubleshooting and system maintenance are long-term endeavors; pricing schemes that offer a low first-year rate only to double it thereafter merely inflate your sunk costs. Transparent, stable renewal pricing provides the peace of mind essential for long-term operational management.

Master the principle of "coexisting ports" (keeping both old and new ports accessible) and remember that VNC is your ultimate fail-safe. By entrusting your underlying infrastructure to a platform like Jtti—which offers stable networking and an intuitive console—you remain in full control, no matter how many network adjustments you need to make. Visit the official Jtti website and experience cloud-based operations that remain resilient even during network outages!

Frequently Asked Questions

Q: Are VNC and Remote Desktop (RDP) the same thing?

A: No. RDP (port 3389) relies on the "TermService" (Remote Desktop Services) running within the Windows OS, and it requires port 3389 to be open at the network layer. VNC, by contrast, captures the screen directly from the underlying hypervisor; it requires no support from any network services within the guest OS, making it a true form of "out-of-band management."

Q: What should I do if my keyboard input doesn't work after accessing VNC?

A: Some browser security policies may block input. We recommend using Chrome or Edge, and clicking the "Send Ctrl+Alt+Del" or "Enable Mouse/Keyboard Input" button on the page. If you are using a Linux system, ensure that the terminal window has the input focus.

Q: I changed my SSH port and allowed the new port through the firewall, but I still can't connect—why? A: Check three areas: 1. Ensure that the new port is allowed in the cloud console's security group; 2. Ensure that the new port is allowed by the system's internal firewall (ufw/firewalld); 3. If SELinux is enabled, verify that you have used `semanage` to add the new port to the `ssh_port_t` list. All three steps are mandatory.

Relevant contents

Comprehensive Guide to Common Default Ports and Port Configuration Strategies for Multi-IP Servers in Website Clusters Can’t connect to a server port? A deep dive into common reasons for port unreachability and blocked access How to Open Ports on a Cloud Server? A Guide to Configuring Both Security Groups and System Firewalls End-to-End Troubleshooting of Memory Errors in Multi-Container Docker Environments: From Tracing 'OOMKilled' Events to Implementing Resource Isolation with Jtti Reimagining DNS Traffic Steering for Bypass Gateways with Rust: A Practical Guide to Preventing DNS Poisoning and Leaks Coexistence of IPv6 and OpenWrt "Side-Route" (Router-on-a-Stick) Configurations: Achieving a Perfect Balance Between OpenClash Traffic Routing and Native IP Addressing Fixing Startup Order After Linux Service Restarts: From Systemd Dependency Analysis to Practical Troubleshooting Jtti Technical Tutorial: A Guide to Deploying OpenClash on an OpenWrt "Side Router" (Router-on-a-Stick) with IPv6 Dual-Stack Compatibility Can data still be recovered after a system drive is formatted? A step-by-step guide to completely erasing all traces of data. An Analysis of Cloud Server Disk Architecture: Why Must System Disks and Data Disks Be Separated?
Go back

24/7/365 support.We work when you work

Support