当前位置:网站首页>ssh免密登陆
ssh免密登陆
2022-07-28 20:46:00 【5xp_2001】
近期同步django配置需要免密同步nas目录 配置整理如下
SSH 三步解决免密登录
1.客户端生成公私钥
本地客户端生成公私钥:(一路回车默认即可)
ssh-keygen
- 1
上面这个命令会在用户目录.ssh文件夹下创建公私钥
cd ~/.ssh
- 1
ls
- 1
下创建两个密钥:
- id_rsa (私钥)
- id_rsa.pub (公钥)
2.上传公钥到服务器
这里测试用的服务器地址为:192.168.235.22
用户为:root
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
- 1
上面这条命令是写到服务器上的ssh目录下去了
cd ~/.ssh
- 1
vim authorized_keys
- 1
可以看到客户端写入到服务器的 id_rsa.pub (公钥)内容。
3.测试免密登录
ssh [email protected]客户端通过ssh连接远程服务器,就可以免密登录了。
补充
[[email protected] .ssh]# ssh-copy-id -i ./id_rsa.pub "-p 58422 [email protected]"
参考https://www.cnblogs.com/chuyiwang/p/10729591.html
报错
ssh-copy-id -i ./id_rsa.pub -p 41022 [email protected]
Bad port 'umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys && (test -x /sbin/restorecon && /sbin/restorecon ~/.ssh ~/.ssh/authorized_keys >/dev/null 2>&1 || true)'
再次报错
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
d5:e0:49:db:cb:ce:09:99:38:b6:7f:20:9a:b6:a6:35.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:5
RSA host key for [101.200.120.97]:41022 has changed and you have requested strict checking.
Host key verification failed.
解决办法 清空了known_hosts文件 测试ssh密码登陆正常 使用默认id_rsa 手动写入authorized 后ok
边栏推荐
- Solve the problem that TS node xxx.ts executes TS code and reports errors
- SQL injection less38 (Stack Injection)
- SQL注入 Less38(堆叠注入)
- hcip实验(14)
- Ngrok intranet penetration
- 使用webWorker执行后台任务
- SQL注入 Less42(POST型堆叠注入)
- Summary of the use of hash table set and map when leetcode brushes questions
- 网易云信 2022Q2 产品补给站,快来获取你的产品补给计划吧!
- Typeof principle
猜你喜欢

XXX port is already in use

想要快速成长,先要经历重大打击!

Chapter 7: drawing rotating cubes

SQL injection less34 (post wide byte injection + Boolean blind injection)

Part 8: creating camera classes
![[CS231N]Lecture_ 2:Image Classification pipelin](/img/4f/de56b071560ada746c587a9dbc5f02.jpg)
[CS231N]Lecture_ 2:Image Classification pipelin

Hcip seventh experiment

Soft exam network engineer

Data visualization news, different forms of news reports

HCIP(11)
随机推荐
Less than a year after its establishment! MIT derivative quantum computing company completed financing of US $9million
105. Construct binary tree from preorder and inorder traversal sequence (medium binary tree DFS hash table binary tree)
乌官员:乌克兰一半农产品经多瑙河港口出口
HCIP(9)
Sword finger offer II 053. Medium order successor in binary search tree (medium binary search tree DFS)
Establishment of Ruiji takeout development environment
(翻译)图技术简明历史
Hcip experiment (12)
Ruiji takeout - background login function development
Chapter 7: drawing rotating cubes
What are the main functions and uses of LCR tester
tutorial/detailed_workflow.ipynb 量化金融Qlib库
SQL injection less38 (Stack Injection)
深度学习必备:对数据集的拆分、根据拆分图片拆分labels、对全部标注标签进行区间检查
Sword finger offer II 056. Sum of two nodes in a binary search tree (simple binary search tree DFS hash table double pointer iterator)
If you want to grow rapidly, you must first experience a major blow!
SQL注入 Less38(堆叠注入)
2021数学建模B组练习
LCR测试仪最为主要的功能和用途都是什么
HCIP(13)