Linux sshssh免密码认证

[[email protected] ~]# ssh-keygen -t rsa #创建密钥对

Generating public/private rsa key pair

Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory ‘/root/.ssh‘.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
e0:19:93:d6:0d:fc:3f:7d:fd:b1:67:af:63:bc:d4:67 [email protected]
The key‘s randomart image is:
+--[ RSA 2048]----+
|       ..        |
|       o.o       |
|      * ...      |
|     o =  .      |
|      o S  . .  .|
|            o .oo|
|             o..E|
|             .+o=|
|             .o=+|
+-----------------+
[[email protected] ~]# ssh-copy-id -i .ssh/id_rsa.pub [email protected] #部署公钥到KVM服务器

The authenticity of host ‘10.0.0.20 (10.0.0.20)‘ can‘t be established.
ECDSA key fingerprint is c3:a2:bc:39:7d:a5:fd:f5:8a:93:28:fd:e6:4c:29:7b.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]‘s password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh ‘[email protected]‘"
and check to make sure that only the key(s) you wanted were added.

[[email protected] ~]# ssh-copy-id -i .ssh/id_rsa.pub [email protected] #部署公钥到KVM服务器

The authenticity of host ‘10.0.0.30 (10.0.0.30)‘ can‘t be established.
ECDSA key fingerprint is c3:a2:bc:39:7d:a5:fd:f5:8a:93:28:fd:e6:4c:29:7b.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]‘s password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh ‘[email protected]‘"
and check to make sure that only the key(s) you wanted were added.

[[email protected] ~]#

[[email protected] ~]# ssh 10.0.0.20 #测试登陆服务器
Last login: Tue May 16 22:27:43 2017 from controller

[[email protected] ~]# ssh 10.0.0.30 #测试登陆服务器

Last login: Tue May 16 22:28:11 2017 from controller

时间: 2024-08-12 06:12:54

Linux sshssh免密码认证的相关文章

Linux scp 免密码 传输文件

Linux scp 免密码 传输文件 背景介绍 最近项目是集群化部署(由 node1,node2,node3 三台 CentOS 7.4 的虚拟机构成). 但是,涉及到跨机器同步文件的问题,想通过写shell文件实现,用 crontab 设置定时任务,定时执行改脚本. 由于每次都需要输入密码,导致定时任务没法正常工作,因此,需要三台机器之间可以免密码互相访问. 建立SSH的信任关系 以实现 node1 免密码给 node2 scp传输文件为例说明,需要如下几个步骤: 1.生成 node1 的秘钥

Hadoop 1.2.1 安装笔记01 : Linux 与免密码

目标: 配置一个hadoop 1.2.1 测试环境  用的JDK是: jdk-7u65-linux-x64.gz 选的hadoop 是: hadoop-1.2.1.tar.gz 均来源Apache和oracle网站 主机规划: Linux版本 :  Centos 6.5 x64位  /boot:用来存放与Linux系统启动有关的程序,比如启动引导装载程序等,建议大小为100MB. /usr:用来存放Linux系统中的应用程序,其相关数据较多,建议大于3GB以上. /var:用来存放Linux系统

windows文件备份到linux:windows定时任务+cwrsync+ssh免密码认证

一.安装cwrsync 二.创建密钥对,实现ssh免密码验证 linux服务器上 [[email protected] ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): ###回车 Created directory '/root/.ssh'. Enter passphrase (empty for no passphras

两台linux系统免密码登陆

一台是192.168.10.131,另一台是192.168.10.135,现在要实现两个需求: 一.是131免密码登陆135,并且scp  rsync 免密码拷贝 二.是用secureCRT工具登陆135时,只能用秘钥登陆,不能用密码登陆 实验步骤如下: 1.在131上运行 ssh-keygen,生成密钥对,其中公钥用于加密,私钥用于解密 2.ssh-copy-id -i  /root/.ssh/id_rsa.pub [email protected],将生成的公钥内容拷贝到135的/root/

Linux SSH 免密码登录

工作中经常要登录的Linux主机太多,每次输密码太麻烦,配过几次免密码登录,每次都记不住,这次记下来备忘. 首先在自己机器上使用 ssh-keygen 工具来创建密钥,如下 ssh-keygen -t rsa 使用 ssh-copy-id 命令自动在目标服务器上生成~/.ssh/authorized_keys文件 ssh-copy-id -i ~/.ssh/id_rsa.pub <目标机器> 转载请以链接形式标明本文地址 本文地址:http://blog.csdn.net/kongxx/art

ssh的免密码认证

ssh 无密码登录要使用公钥与私钥.linux下可以用用ssh-keygen生成公钥/私钥对,下面我以CentOS为例. 注意:如果root用户不能够登录就要关闭Selinux和防火墙. 有机器A(192.168.1.155),B(192.168.1.181).现想A通过ssh免密码登录到B. 首先以root账户登陆为例. 1.在A机下生成公钥/私钥对. [[email protected] ~]# ssh-keygen -t rsa -P '' -P表示密码,-P '' 就表示空密码,也可以不

Linux 配置免密码远程登录

前言 啃爹的教程,我再写一篇. 你需要搞清楚的是 1.搞清哪台linux主机登录哪台linux主机不需要密码? 2.两台主机用户名密码保持一致(建议这么做,尽管有root). about it 假如A Host 登录 B Host 不需要密码.那么你需要在 B Host上生成公钥.然后把公钥导入到 A Host.B Host 也要 导入B  Host 的公钥. id_rsa         :私钥    id_rsa.pub  :公钥 假设B Host 登录 A Host 不需要密码.就跟上面相

Linux ssh免密码登陆Linux服务器

1.原理和secureCRT免密码登陆Linux是类似的,只是这里的客户端不是crt而是Linux. 2.具体过程: 注意:以上内容均为原创作品 转载请注明出处http://blog.csdn.net/wangquannetwork/article/details/46122463

Linux - Shell - 免密码登录

概述 简述 linux ssh 无密码登录 无能狂怒 最近真是不知道写啥了 环境 os centos7 1. 场景 场景 主机A 需要经常访问 主机B 每次访问, 都要输入一次 密码 问题 每次都输密码很麻烦 解决思路 windows 找一个 终端软件, 保存登录信息 linux 配置 ssh 免密码登录 2. ssh 免密码登录 概述 简介 ssh 免密码登录 原理 ssh 登录方式 这个我也不太懂, 就略了 非对称加密 主机A 生成 公钥 和 私钥 主机B 保留 主机A 的公钥 3. 配置