Liunx 中使用ssh登录配置问题
来源:互联网 发布:数据字典的作用 编辑:程序博客网 时间:2024/06/08 08:54
一、使用SSH无密码登录问题设置;
1:在需要无密码登录的主机上运行如下命令
$ ssh-keygen -t rsa
将会在用户文件夹下生成:.ssh/
2:将.ssh文件夹下的id_ras.pub ;传到需要登录的主机上
$scp ./.ssh/id_ras.pub root@10.0.0.2:/root/
3:将10.0.0.2主机上将id_ras.pub>>到authorized_keys 中
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
4:完成;可以使用ssh无密钥登录了
二、出现无法的登录的解决办法
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
5c:9b:16:56:a6:cd:11:10:3a:cd:1b:a2:91:cd:e5:1c.
Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
Offending key in /home/user/.ssh/known_hosts:1
RSA host key for ras.mydomain.com has changed and you have requested strict checking.
Host key verification failed.
解决方案一:需要在要远程登录的机器中删除.ssh/known_hosts 文件;
如果设置了无密钥登录,那么可能在登录时有warn,每次都要进行;比较输入yes;解决方案就是;删除本机的.ssh/known_hosts文件
Solution #2: Remove keys //只删远程连接机器的key
Use the -R option to removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts. If your remote hostname is server.example.com, enter:
$ ssh-keygen -R {server.name.com}
$ ssh-keygen -R {ssh.server.ip.address}
$ ssh-keygen -R server.example.com
Solution #3: Add correct host key in /home/user/.ssh/known_hosts
It is not necessary to delete the entire known_hosts file, just the offending line in that file. For example if you have 3 server as follows.
myserver1.com,64.2.5.111 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA11FV0EnGahT2EK8qElocjuHTsu1jaCfxkyIgBTlxlrOIRchb2pw8IzJLOs2bcuYYfa8nSXGEcWyaFD1ifUjfHelj94AAAAB3NzaC1yc2EAAAABIwAAAIEA11FV0E
nGahT2EK8qElocjuHTsu1jaCfxkyIgBTlxlrOIRchb2pw8IzJLOs2bcuYYfa8nSXGEcWyaFD1ifUjfHelj94H+uv304/ZDz6xZb9ZWsdm+264qReImZzruAKxnwTo4dcHkgKXKHeefnBKyEvvp/2ExMV9WT5DVe1viVwk=
myserver2.com,125.1.12.5 ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAQEAtDiERucsZzJGx/1kUNIOYhJbczbZHN2Z1gCnTjvO/0mO2R6KiQUP4hOdLppIUc9GNvlp1kGc3w7B9tREH6kghXFiBjrIn6VzUO4uwrnsMbnAnscD5EktgI7fG4ZcNUP 5+J7sa3o+rtmOuiFxCA690DXUJ8nX8yDHaJfzMUTKTGxQz4M/H2P8L2R//qLj5s3ofzNmgSM9lSEhZL/IyI4NxHhhpltYZKW/Qz4M/H2P8L2R//qLj5s3ofzNmgSM9lSEhZL/M7L0vKeTObue1SgAsXADtK3162a/Z6MGnAazIviHBldxtGrFwvEnk82+GznkO3IBZt5vOK2heBnqQBfw=
myserver3.com,125.2.1.15 ssh-rsa
5+J7sa3o+rtmOuiFxCA690DXUJ8nX8yDHaJfzMUTKTGx0lVkphVsvYD5hJzm0eKHv+oUXRT9v+QMIL+um/IyI4NxHhhpltYZKW
as3533dka//sd33433////44632Z6MGnAazIviHBldxtGrFwvEnk82/Qz4M/H2P8L2R//qLj5s3ofzNmgSM9lSEhZL/M7L0vKeTObue1SgAsXADtK3162a/Z6MGnAazIviHBldxtGrFwvEnk82+GznkO3IBZt5vOK2heBnqQBfw==
To delete 2nd server (myserver.com), open file:
# vi +2 .ssh/known_hosts
And hit dd command to delete line. Save and close the file. Or use following
$ vi ~/.ssh/known_hosts
Now go to line # 2, type the following command
:2
Now delete line with dd and exit:
dd
:wq
Solution 4: Just delete the known_hosts file If you have only used one ssh server
$ cd
$ rm .ssh/known_hosts
$ ssh ras.mydomain.com
- Liunx 中使用ssh登录配置问题
- mac & liunx ssh 自动登录
- liunx 设置ssh 自动登录
- SSH配置使用证书登录
- Linux管理工作,实例讲解工作中使用ssh证书登录的实际流程,讲解ssh证书登录的配置原理,基于配置原理,解决实际工作中,windows下使用SecureCRT证书登录的各种问题,以及实现hadoo
- liunx SSH密钥 免密码登录
- ssh免密登录配置问题
- Linux配置ssh使用key登录
- 配置ssh使用密钥登录,禁止口令登录
- ssh中使用spring配置
- liunx中apache+tomcat配置
- liunx中apache+tomcat配置
- 配置SSH 远程登录
- 配置SSH自动登录
- SSH远程登录配置
- linux 配置ssh 登录
- 配置SSH远程登录
- 配置SSH无密码登录时遇到的问题
- nyoj_14_会场安排问题(贪心)
- [JAVA]找不到或无法加载主类Demo
- Oracle的分析函数
- java中可变长参数
- emacs在win8乱码
- Liunx 中使用ssh登录配置问题
- DOM应用案例--选择输入对话框
- redis学习笔记(三)
- 什么是物理事务和逻辑事务?
- 平衡二叉树旋转平衡(要看)!
- 重要数据的计划任务备份和ACL权限的设置
- 七步入门CMake之第四步(自我检查)
- C++11 中的线程、锁和条件变量
- final修饰一个对象