安装SSH服务
在Ubuntu终端执行:
sudo apt update && sudo apt install openssh-server
sudo systemctl start ssh && sudo systemctl enable ssh # 启动并设置开机自启
生成SSH密钥对(可选,用于密钥认证)
本地终端执行:
ssh-keygen -t rsa -b 4096 # 生成密钥对,默认保存在~/.ssh/
ssh-copy-id user@ubuntu_ip # 复制公钥到服务器(需输入密码)
配置SecureCRT连接
~/.ssh/id_rsa
)。保存并连接
点击 Save 保存会话,双击即可快速连接。首次使用密钥认证时需输入私钥密码(若有)。
安全增强(可选)
/etc/ssh/sshd_config
):PubkeyAuthentication yes
PasswordAuthentication no # 禁用密码认证(仅限密钥登录)
KexAlgorithms curve25519-sha256@libssh.org # 指定安全密钥交换算法
修改后重启SSH:sudo systemctl restart ssh
。sudo ufw allow 22