视频加载失败

SSH免密码登录

118 字
1 分钟
SSH免密码登录
SSH免密码登录

0x00 前言#

实现ssh服务器免密码登录

0x01 生成密钥#

命令行:

Terminal window
ssh-keygen -t rsa #使用rsa加密

在当前用户根目录下~/.ssh/会生成两个文件:id_rsa(密钥文件),id_rsa.pub(公钥文件)

0x02 发送公钥到服务器#

1.使用ssh自带工具发送

Terminal window
ssh-copy-id -i ~/.ssh/id_rsa.pub <UserName>@<ServerIP>

2.使用scp发送

Terminal window
scp -p ~/.ssh/id_rsa.pub <UserName>@<ServerIp>:~/.ssh/authorized_keys

0x03 常见问题#

如果提示权限不够,修改权限即可

Terminal window
chmod 755 ~/.ssh/
chmod 600 ~/.ssh/id_rsa ~/.ssh/id_rsa.pub
chmod 644 ~/.ssh/known_hosts

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或打赏支持!

打赏
SSH免密码登录
https://rehtt.com/posts/29/
作者
Rehtt
发布于
2018-03-06
许可协议
CC BY-NC-SA 4.0

评论区

Profile Image of the Author
Rehtt
Hello, I'm Rehtt.
公告
欢迎来到我的博客!
分类
标签
最新动态
站点统计
文章
150
分类
17
标签
73
总字数
67,772
运行时长
0 天
最后活动
0 天前
站点信息
构建平台
Local
博客版本
Firefly v6.16.8
文章许可
CC BY-NC-SA 4.0
文章目录