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

PUTTY无法连接至Azure Linux(Ubuntu 18.04)虚拟机的技术求助

Hey there, let's work through this PuTTY connection issue with your Azure Ubuntu 18.04 VM step by step. I’ve helped folks troubleshoot this exact scenario plenty of times, so let’s start with the most common fixes first:

1. Verify VM Network & Security Settings
  • First, confirm your VM has a public IP address assigned (check this in the Azure portal under your VM's "Networking" tab). Without a public IP, you can't reach it directly from your local machine.
  • Check the attached Network Security Group (NSG) to ensure inbound traffic on port 22 (SSH) is allowed. Head to the NSG's "Inbound security rules"—there should be a rule permitting port 22 from your local IP (or use 0.0.0.0/0 temporarily for testing, though avoid this long-term for security).
2. Double-Check PuTTY Configuration
  • When entering your VM's public IP in PuTTY, make sure the port is set to 22 (unless you explicitly changed the SSH port on your VM).
  • If using SSH keys (the recommended method):
    • PuTTY can't use standard PEM keys directly—you need to convert your private key to PuTTY's PPK format with PuTTYgen. Open PuTTYgen, click "Load", select your private key file (set the filter to "All Files" to see it), then click "Save private key" to generate the PPK.
    • In PuTTY, navigate to Connection > SSH > Auth and browse to select the PPK file you created.
  • If using password authentication:
    • Ensure password login is enabled on the VM. Use the Azure portal's "Connect > SSH" option to access the VM first, then edit /etc/ssh/sshd_config and set PasswordAuthentication yes. Restart the SSH service with sudo systemctl restart sshd, then try PuTTY again.
3. Check the VM's SSH Service
  • Use the Azure portal's "Serial Console" (under "Support + troubleshooting" for your VM) to log into the VM. Run sudo systemctl status sshd to confirm the SSH daemon is running. If it's stopped, start it with sudo systemctl start sshd.
  • Verify the daemon is listening on port 22 with sudo netstat -tulpn | grep sshd—you should see an entry for 0.0.0.0:22 or :::22.
4. Resolve Host Key Warnings/Errors
  • If PuTTY warns about an unrecognized host key, that's normal on first connection—click "Yes" to cache it. If you get a "host key changed" error, this usually means the VM was recreated or you're using the wrong IP. Double-check the VM's public IP in Azure.
5. Rule Out PuTTY-Specific Issues (Optional)
  • Test connecting from your local machine's built-in SSH client (if on Linux/macOS) with ssh your-username@vm-public-ip. If this works, the problem is definitely in your PuTTY setup; if it fails, the issue lies with the VM or network configuration.

内容的提问来源于stack exchange,提问作者Raj Gohel

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.29 14:14:05