要让SecureCRT通过SSH连接Ubuntu,首先需要确保Ubuntu系统已安装并启动SSH服务。
sudo apt update
sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh
sudo systemctl status ssh
sudo ufw allow 22
/etc/ssh/sshd_config(如将端口改为2222,需将Port 22改为Port 2222;若需禁用密码认证,需将PasswordAuthentication yes改为PasswordAuthentication no),修改后重启SSH服务使配置生效:sudo systemctl restart ssh
安装并配置好Ubuntu的SSH服务后,即可通过SecureCRT创建SSH会话实现连接。
192.168.1.100)或域名;ubuntu或root)。若需替代密码认证,可使用SSH密钥对进行认证(更安全,推荐配置)。
~/.ssh/id_rsa.pub,若未生成密钥对,需先在本地生成)。ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
按提示操作(可直接按回车键使用默认路径和空密码),生成后会得到id_rsa(私钥,需妥善保管)和id_rsa.pub(公钥)两个文件。~/.ssh/authorized_keys文件中。可通过以下命令一键完成:ssh-copy-id -i ~/.ssh/id_rsa.pub username@your_server_ip
若未安装ssh-copy-id工具,可手动复制:将id_rsa.pub文件内容追加到服务器~/.ssh/authorized_keys文件中(需先创建.ssh目录并设置权限):mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "公钥内容" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
id_rsa)。/etc/ssh/sshd_config文件,将PasswordAuthentication yes改为PasswordAuthentication no,并确保以下配置项正确:PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
修改后重启SSH服务:sudo systemctl restart ssh
sudo systemctl status ssh);sudo ufw allow 22);~/.ssh/authorized_keys文件的权限是否为600(chmod 600 ~/.ssh/authorized_keys);/etc/ssh/sshd_config中的PubkeyAuthentication是否设为yes;-----BEGIN RSA PRIVATE KEY-----开头,公钥为ssh-rsa AAAAB3...格式)。