温馨提示×

SecureCRT连不上Ubuntu

小樊
46
2026-08-22 21:53:51
栏目: 智能运维

SecureCRT 连不上 Ubuntu,常见原因集中在 SSH 服务、网络、防火墙、配置或客户端设置 上。下面按排查顺序给你一套完整方案(适用于 Ubuntu 20.04/22.04/24.04)。


一、确认 Ubuntu 是否开启 SSH 服务

1️⃣ 检查是否安装并运行 sshd

在 Ubuntu 上执行:

ps -ef | grep sshd

如果没有 sshd,安装并启动:

sudo apt update
sudo apt install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh

检查状态:

sudo systemctl status ssh

✅ 应该是 active (running)


二、确认 IP 地址和网络是否可达

2️⃣ 查看 Ubuntu IP

ip a

一般是以 192.168.x.x10.x.x.x 开头。

3️⃣ 测试网络连通性(在 Windows 上)

ping Ubuntu_IP

❌ ping 不通:

  • 虚拟机:检查是否是 NAT / 桥接模式
  • 云服务器:检查安全组是否放行 22 端口

三、确认 SSH 端口与配置

4️⃣ 查看 SSH 端口

grep Port /etc/ssh/sshd_config

默认是:

Port 22

如果改过端口,SecureCRT 要对应修改。

5️⃣ 允许密码或 root 登录(常见坑)

编辑配置:

sudo nano /etc/ssh/sshd_config

确认或修改为:

PasswordAuthentication yes
PermitRootLogin yes

然后重启 SSH:

sudo systemctl restart ssh

四、防火墙是否拦截

6️⃣ Ubuntu 防火墙(UFW)

查看状态:

sudo ufw status

如果开启,放行 SSH:

sudo ufw allow 22
sudo ufw reload

五、SecureCRT 客户端设置检查

7️⃣ 协议与端口

  • Protocol:SSH2
  • Port:22(或你改过的端口)
  • Hostname:Ubuntu 的 IP

8️⃣ 认证方式

  • 用户名要正确
  • 密码登录:确认 Ubuntu 用户密码正确
  • 密钥登录:确认私钥格式(SecureCRT 支持 OpenSSH / PuTTY)

六、常见错误与对应原因

SecureCRT 报错 可能原因
Connection timed out IP 不通 / 防火墙
Connection refused sshd 未启动
No supported authentication methods 禁用了密码登录
Server unexpectedly closed network connection SSH 配置错误
中文乱码 编码问题

七、如果是虚拟机(VMware / VirtualBox)

VMware

  • 桥接模式 ✅(推荐)
  • NAT 模式:需端口映射

VirtualBox

  • 网络选 桥接网卡
  • 或 NAT + 端口转发(主机 2222 → 虚拟机 22)

八、快速自检清单 ✅

✅ sshd 正在运行
✅ 22 端口开放
✅ 防火墙放行
✅ IP 能 ping 通
✅ SecureCRT 协议/端口正确


九、我可以进一步帮你定位

你可以直接把下面信息发我(可打码):

  1. SecureCRT 报错截图或文字
  2. Ubuntu 是 实体机 / 虚拟机 / 云服务器
  3. ssh user@ip 在本地是否能连
  4. Ubuntu 版本号

我可以一步一步帮你精确到“哪一行配置错了”。

0