ubuntu

ubuntu如何配置securecrt安全连接

小樊
47
2025-08-11 07:49:45
栏目: 智能运维

  1. 安装SSH服务
    在Ubuntu终端执行:

    sudo apt update && sudo apt install openssh-server
    sudo systemctl start ssh && sudo systemctl enable ssh  # 启动并设置开机自启
    
  2. 生成SSH密钥对(可选,用于密钥认证)
    本地终端执行:

    ssh-keygen -t rsa -b 4096  # 生成密钥对,默认保存在~/.ssh/
    ssh-copy-id user@ubuntu_ip  # 复制公钥到服务器(需输入密码)
    
  3. 配置SecureCRT连接

    • 打开SecureCRT,选择 File > New Session,输入:
      • Protocol:SSH2
      • Hostname:Ubuntu服务器IP
      • Port:22(默认)
      • Username:服务器用户名
    • 认证方式
      • 密码认证:在 SSH2 > Auth 中选择 Password,输入密码。
      • 密钥认证:选择 Key Pair,指定私钥文件路径(如~/.ssh/id_rsa)。
    • 高级设置
      • 勾选 Use Diffie-Hellman key exchange 等安全算法。
      • 设置会话超时断开,避免长时间空闲。
  4. 保存并连接
    点击 Save 保存会话,双击即可快速连接。首次使用密钥认证时需输入私钥密码(若有)。

  5. 安全增强(可选)

    • 在服务器端修改SSH配置(/etc/ssh/sshd_config):
      PubkeyAuthentication yes
      PasswordAuthentication no  # 禁用密码认证(仅限密钥登录)
      KexAlgorithms curve25519-sha256@libssh.org  # 指定安全密钥交换算法
      
      修改后重启SSH:sudo systemctl restart ssh
    • 配置防火墙(UFW)放行SSH端口:
      sudo ufw allow 22
      

0
看了该问题的人还看了