当前位置:网站首页>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
边栏推荐
- internet的基本服务中文件传输命令是哪个
- HCIP(11)
- Differences of display values
- 什么是时间复杂度
- HCIP(12)
- DHCP and PPPoE protocols and packet capture analysis
- LCR测试仪最为主要的功能和用途都是什么
- Necessary for in-depth learning: split the data set, split the labels according to the split pictures, and check the interval of all marked labels
- Sword finger offer II 065. The shortest word code (medium dictionary tree string array)
- Solve the problem that TS node xxx.ts executes TS code and reports errors
猜你喜欢

Lvs+keepalived high availability deployment practical application

Jmeter 安装第三方插件 Plugins Manager

HYDAC overflow valve db08a-01-c-n-500v

静态成员static详解

2021 mathematical modeling group B exercise

Static details of static members

Soft exam network engineer

What are the main functions and uses of LCR tester

Record the fluent to solve the problem of a renderflex overflowed by 7.3 pixels on the bottom

网易云信 2022Q2 产品补给站,快来获取你的产品补给计划吧!
随机推荐
深度学习必备:对数据集的拆分、根据拆分图片拆分labels、对全部标注标签进行区间检查
76. Minimum coverage substring (hard sliding window hash table string)
hcip实验(12)
Jianzhi offer II 062. implement prefix tree (medium design dictionary tree prefix tree string)
TensorFlow Serving 高性能的机器学习模型服务系统
How about the actual use effect of common source oscilloscope
Bugku, Web: all filtered
If you want to grow rapidly, you must first experience a major blow!
ssh 免密码登录
Netease Yunxin 2022q2 product supply station, come and get your product supply plan!
HCIP(9)
软考网络工程师
容器化配置启动redis集群 单机6节点 3主3从
internet的基本服务中文件传输命令是哪个
openresty 请求鉴权
【二叉树】二叉树中的伪回文路径
Record the fluent to solve the problem of a renderflex overflowed by 7.3 pixels on the bottom
SQL注入 Less34(POST型宽字节注入+布尔盲注)
winServer运维技术栈
IFLYTEK written examination