设置 ssh 无密码登录
检查现有 SSH 密钥对。
> ls -al ~/.ssh/id_*.pub
> No such file or directory
生成新的 SSH 密钥对。
> ssh-keygen -t rsa -b 4096 -C "your_email@domain.com"
> Enter file in which to save the key (/home/yourusername/.ssh/id_rsa):
> Enter passphrase (empty for no passphrase):

ls ~/.ssh/id_*/home/yourusername/.ssh/id_rsa /home/yourusername/.ssh/id_rsa.pub
复制公钥。
> ssh-copy-id rumenz@rumenz.com
> rumenz@rumenz.com's password:
> cat ~/.ssh/id_rsa.pub | ssh rumenz@rumenz.com "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
使用 SSH 密钥登录到你的服务器。
> ssh rumenz@rumenz.com
禁用 SSH 密码认证
代码小浣熊
代码小浣熊是基于商汤大语言模型的软件智能研发助手,覆盖软件需求分析、架构设计、代码编写、软件测试等环节
51 查看详情
以具有 sudo 权限或 root 的用户身份使用 SSH 密钥登录远程服务器:
> ssh sudo_user@server_ip_address
打开 SSH 配置文件 /etc/ssh/sshd_config,搜索如下指令,修改如下:
> vim /etc/ssh/sshd_configPasswordAuthentication noChallengeResponseAuthentication noUsePAM no
> systemctl restart ssh
> systemctl restart sshd
以上就是linux如何设置无密码SSH登录的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/477026.html
微信扫一扫
支付宝扫一扫