温馨提示×

ubuntu securecrt怎么配置

小樊
44
2025-11-28 13:09:22
栏目: 智能运维

Ubuntu 上使用 SecureCRT 的完整配置指南

一 安装 SecureCRT

  • 获取适用于 Linux 的安装包(常见为 .deb),在终端执行安装,例如:
    • 安装命令:sudo dpkg -i scrt-<版本号>.deb
    • 若提示缺少依赖:sudo apt-get -f install
  • 安装完成后从应用菜单启动 SecureCRT

二 在 Ubuntu 服务器启用 SSH 服务

  • 安装 OpenSSH 服务器:sudo apt-get update && sudo apt-get install openssh-server
  • 启动并设置开机自启:
    • sudo systemctl start ssh
    • sudo systemctl enable ssh
  • 检查状态:sudo systemctl status ssh(应显示为 active (running)
  • 如需自定义端口或认证方式,编辑 /etc/ssh/sshd_config,修改后执行:sudo systemctl restart ssh

三 在 SecureCRT 中新建并保存会话

  • 打开 SecureCRTFile → New Session(或 Quick Connect
  • 配置连接参数:
    • Protocol:选择 SSH2
    • Hostname/IP:填入 Ubuntu 服务器地址
    • Port:默认 22
    • Username:你的登录用户名
    • 认证方式:可选择 PasswordPublicKey
  • Session Options 中可按需调整:
    • Terminal → Appearance:设置字体、颜色、字符编码为 UTF-8(解决中文乱码)
    • Terminal → Emulation:终端类型常用 xtermvt100
  • 点击 Connect 测试,确认无误后 Save As 保存会话以便下次双击快速连接。

四 认证与安全建议

  • 推荐使用 SSH 密钥认证
    • Session Options → Connection → SSH2 → Authentication 选择 PublicKey,指定私钥路径(如 ~/.ssh/id_rsa
    • 确保私钥权限为 600chmod 600 ~/.ssh/id_rsa
  • 如需禁用密码登录,可在服务器 /etc/ssh/sshd_config 中设置 PasswordAuthentication no,并重启 sshsudo systemctl restart ssh

五 常见故障排查

  • 连接被拒绝或超时:
    • 确认服务器 SSH 服务已启动sudo systemctl status ssh
    • 检查云服务器安全组/本机防火墙是否放行 22 端口;必要时临时测试:sudo ufw disable
  • 算法不兼容报错(如 “No compatible hostkey/key exchange method”):
    • 在客户端启用更多 HostKeyAlgorithms/KexAlgorithms(SecureCRT 会话设置中)
    • 或在服务器 /etc/ssh/sshd_config 增加兼容项(示例):
      • HostKeyAlgorithms=+ssh-rsa,ssh-dss
      • KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
    • 修改后重启 sshsudo systemctl restart ssh
  • 中文乱码:
    • Session Options → Terminal → Appearance → Character 选择 UTF-8

0