You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

注释RSAAuthentication与PubkeyAuthentication后无法连接Azure Ubuntu虚拟机

Troubleshooting SSH Connection Failures to Azure Ubuntu VM

Let’s work through this step by step— I’ve debugged dozens of these Azure VM SSH issues, so let’s start with the most common culprits first:

1. Verify Azure Platform Network Configurations

Don’t skip this— Azure’s network rules often block SSH traffic even if your VM’s internal config is correct:

  • Check Network Security Group (NSG) Inbound Rules:
    Head to the Azure Portal, find your VM, navigate to its associated NSG. Ensure there’s an inbound rule allowing traffic on port 22 (SSH), with the source set to your development machine’s public IP (or temporarily set to Any for testing— just remember to lock it down later).
  • Confirm VM Public IP:
    Azure VMs with dynamic IPs can change after a restart. Double-check the public IP in the Azure Portal matches what you’re entering in Bitvise.
  • Check VM Health Status:
    Make sure the VM is in a "Running" state in the portal. If it’s stuck or has a fault, that could block connections entirely.

2. Validate VM Internal SSH Service & Config

You’ve modified sshd_config, but let’s make sure those changes are active and correct:

  • Restart SSHD Service After Config Changes:
    This is a super common oversight— any edits to sshd_config won’t take effect until you restart the service. Run this command in your VM (use Azure Serial Console if you can’t SSH in):
    sudo systemctl restart sshd
    # For older Ubuntu versions, use: sudo service ssh restart
    
  • Double-Check sshd_config Settings:
    Open the file again with sudo nano /etc/ssh/sshd_config and verify these lines (ensure they’re not commented out with #):
    • PasswordAuthentication yes (this is mandatory for password-based SSH)
    • PermitRootLogin yes (only if you’re trying to log in as root; if using your admin user, this can be prohibit-password)
    • If you commented out RSAAuthentication and PubkeyAuthentication, that’s fine for password-only login— just make sure no other lines are overriding PasswordAuthentication.
  • Check SSHD Logs for Exact Errors:
    Logs will tell you why connections are failing (wrong password, user not allowed, config error, etc.). Run this to view recent SSH activity:
    sudo journalctl -u sshd
    # Or check the auth log: sudo cat /var/log/auth.log
    
    Look for lines like Failed password for user X or Connection closed by Y [preauth]— these are direct clues to the problem.

3. Local Development Environment Checks

Sometimes the issue is on your end, not the VM:

  • Test with Another SSH Client:
    Try connecting with PuTTY or the Windows built-in SSH client (ssh username@vm-ip) to rule out a Bitvise-specific bug.
  • Verify Login Credentials:
    Azure Ubuntu VMs don’t use root by default— make sure you’re using the admin username you set when creating the VM, not root. Double-check the password too (Azure sometimes auto-generates complex ones if you didn’t set your own).
  • Check Local Firewall/Proxy:
    You configured Windows outbound rules, but some antivirus tools or proxies can still block SSH traffic. Try disabling your proxy temporarily, or adding an exception for Bitvise in your antivirus.

4. Quick Test with Azure Serial Console

If you’re still stuck, use the Azure Portal’s Serial Console to log into your VM directly:

  • Once logged in, test SSH locally with ssh localhost— if this works, the SSH service is running correctly, and the problem is definitely network-related.
  • If it fails, you’ll get an error message that points directly to the internal issue (e.g., SSH service not running, config error).

内容的提问来源于stack exchange,提问作者E. Erfan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:46:29