SecureCRT连接Debian时加密传输的配置步骤
Debian系统默认安装OpenSSH服务器(openssh-server),若未安装,可通过以下命令安装并启动:
sudo apt update && sudo apt install openssh-server -y # 安装SSH服务
sudo systemctl start ssh && sudo systemctl enable ssh # 启动并设置开机自启
通过ip addr show命令获取Debian服务器的IP地址(如192.168.1.100),用于SecureCRT连接。
192.168.1.100)。root或普通用户),避免每次连接时重复输入。your_password)。在Debian服务器上生成SSH密钥对:
若Debian服务器尚未生成密钥对,通过SSH登录服务器后执行:
ssh-keygen -t rsa -b 4096 # 生成4096位的RSA密钥对(更安全)
默认保存路径为~/.ssh/id_rsa(私钥)和~/.ssh/id_rsa.pub(公钥)。
将公钥添加到Debian服务器的authorized_keys文件:
执行以下命令将公钥内容追加到~/.ssh/authorized_keys:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys # 设置私钥文件权限(仅所有者可读写)
在SecureCRT中配置私钥:
回到SecureCRT的“Session Properties”窗口,选择Connection → SSH2 → Auth标签。
点击“Browse”按钮,选择本地的私钥文件(如id_rsa,需与Debian服务器上的公钥配对)。
勾选“Attempt authentication using Pageant”(可选,若使用Pageant管理密钥,可自动加载)。
在“Session Properties”窗口中选择Connection → SSH2 → Encryption标签:
ecdh-sha2-nistp521、ecdh-sha2-nistp384或diffie-hellman-group-exchange-sha256(抗量子计算攻击,安全性高)。aes256-ctr、aes192-ctr或aes128-ctr(对称加密,强度高),避免使用3des(已过时)。hmac-sha2-512或hmac-sha2-256(防止数据篡改)。/etc/ssh/sshd_config文件中修改以下配置:PasswordAuthentication no # 关闭密码认证
修改后重启SSH服务:sudo systemctl restart ssh。