使用ssh密钥登录securecrt,增强安全性并提升效率。以下步骤将引导您完成密钥配置:
第一步:密钥对生成
在securecrt中,依次点击“工具”>“生成密钥对”。选择rsa加密算法(推荐),设置密钥长度(默认1024位即可),并设置一个安全口令。点击“完成”生成私钥(identity)和公钥(identity.pub)文件。
第二步:公钥上传至服务器
使用ftp或其他工具将identity.pub文件上传到服务器的~/.ssh目录。 请确保文件格式为ascii码。上传后,在服务器端执行以下命令设置权限:
cd /home/your_user mkdir -p .ssh chmod 700 .ssh mv identity.pub .ssh/authorized_keys chmod 644 .ssh/authorized_keys
第三步:服务器ssh配置
编辑服务器的ssh配置文件/etc/ssh/sshd_config (使用sudo vim /etc/ssh/sshd_config),确保以下配置项正确:
permitrootlogin no pubkeyauthentication yes authorizedkeysfile .ssh/authorized_keys rsaauthentication yes passwordauthentication no
保存后,重启ssh服务使配置生效:sudo /etc/init.d/ssh restart (命令可能因系统而异,例如systemctl restart ssh)
第四步:securecrt会话配置
在securecrt中,点击“文件”>“新建会话”。输入服务器ip地址或域名,选择ssh2协议。在ssh2选项卡中,选择“公钥”认证,并浏览导入生成的私钥文件(identity)。确保私钥文件权限为600。点击“确定”保存会话配置。
完成以上步骤后,即可使用ssh密钥登录,无需再输入密码。
以上就是securecrt如何配置ssh密钥的详细内容,更多请关注代码网其它相关文章!
发表评论