首页 > 系统相关 >Linux-主机之间创建免密

Linux-主机之间创建免密

时间:2024-01-18 21:24:09浏览次数:27  
标签:免密 主机 192.168 ssh key Linux copy root id

一、四台主机进行免密

192.168.10.6
192.168.10.11
192.168.10.12
192.168.10.13

二、192.168.10.6主机生成密钥对,并将公钥传输到其它所有主机。

root@k8s-master01:~# ssh-keygen -t rsa -P ''
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
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:
SHA256:BkqF1ysQP9COkjGM3LEDoYP+akQaK8Zuef7VcmTnOR0 root@k8s-master01
The key's randomart image is:
+---[RSA 3072]----+
|.=o.++..         |
|+.=.++o .        |
|+  *.=+  .       |
|ooo.o.oo.        |
|++ ..  .So . E   |
|++.    .+ o o .  |
|= ..   o o + .   |
| =..  . o   .    |
|o.o...           |
+----[SHA256]-----+

root@k8s-master01:~# ssh-copy-id -i .ssh/id_rsa.pub [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
The authenticity of host '192.168.10.6 (192.168.10.6)' can't be established.
ED25519 key fingerprint is SHA256:rP2GqlXjoG0UGi/kNixh1qXFg1dd1zJHIz2LutbTn80.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? 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.

root@k8s-master01:~# ssh-copy-id -i .ssh/id_rsa.pub [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
The authenticity of host '192.168.10.11 (192.168.10.11)' can't be established.
ED25519 key fingerprint is SHA256:sm5LyiMTU6zs8worQAgtjgx+rQPR/nXQIoBB+ETGPGU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? 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.

root@k8s-master01:~# ssh-copy-id -i .ssh/id_rsa.pub [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
The authenticity of host '192.168.10.13 (192.168.10.13)' can't be established.
ED25519 key fingerprint is SHA256:qibMIGG51Rj4vpV+yEsw0swurRYhrYWWZOWIBPQmC3g.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? 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.

标签:免密,主机,192.168,ssh,key,Linux,copy,root,id
From: https://www.cnblogs.com/OpenSourceSite/p/17973419

相关文章

  • Linux系统的uid和euid
    Linux内核为每个进程维护三个uid值,分别是ruid(realuid,实际用户ID),euid(effectiveuid,有效用户ID),suid(savedset-user-id,保存的设置用户ID)uid:真实的用户ID,进程的uid就是其创建者的用户ruid:用于在系统中标识一个用户是谁,当用户使用用户名和密码成功登录一个Linux系统后就唯一......
  • Linux的getenv putenv setenv和unsetenv(转载)
    1、getenv函数头文件:#include<stdlib.h>函数原型:char*getenv(constchar*name);函数说明:getenv()用来取得参数name环境变量的内容。函数参数:name为环境变量的名称,如果该变量存在则会返回指向该内容的指针。环境变量的格式为name=value。返回值:若环境......
  • FAQ-linux登录失败或者执行命令提示bash: fork: Cannot allocate memory
    一、现象服务器登录失败或者提示失败bash:fork:Cannotallocatememory二、盘查1、先使用free-m查看内存有没有问题2、没有问题再看最大进程数sysctlkernel.pid_max3、然后核实下当前的进程数ps-eLf|wc-l三、解决方法修改最大进程数后系统恢复echo100000......
  • Linux网卡配置文件解析
    [root@localhost130~]#cat/etc/sysconfig/network-scripts/ifcfg-ens33TYPE="Ethernet"#网络类型为以太网#PROXY_METHOD="none"#代理方式#BROWSER_ONLY="no"#只是浏览器:否BOOTPROTO="static"#网卡协议获取网卡ip的方式,dhcp动态主机配置协议也就是自动获取,no......
  • Linux awk命令
    Linuxawk命令今天,在看面经过程中,看到有关于linux指令的问题,想到自己一直对awk不太熟悉,今天详细学习一下,记录一下增强记忆,也希望在今后的工作中能够使用它。Linux三剑客:grep(过滤文本)sed(修改文本)awk(处理文本)语法格式awk[参数][处理内容][操作对象]使用实例参数取值:......
  • 关于linux系统查找规定时间点的文件和文件数(find)
    find./-mtime-5-typef-empty-execls-lt{}\;|morefindlinux查找命令find./当前目录下查找-mtime1表示文件修改时间距离当前为1天的文件,即距离当前时间1天(24小时-48小时)的文件-mtime0表示文件修改时间距离当前为0天的文件,即距离当前时间不到1天(24小时)以内的文......
  • Linux中利用shell脚本提升cpu使用率
    使用背景:因新申请下来的服务器暂时没有部署任何应用导致cpu使用率很低,那资源组那边给出两个方案,1.要不把服务器用起来2服务器进行降配降配是不可能降配的,后面正式用起来去升配就很麻烦了使用说明:这个脚本主要是针对多核服务器进行使用,前提你想让你服务器......
  • Linux命令
    Port(Linux)#查看端口占用netstat-nlp|grep[端口号]Port(Windows)#查看指定端口的占用情况netstat-aon|findstr“端口号”#查看进程或者程序占用了相应的端口tasklist|findstr“被占用端口对应的PID”#结束端口占用的进程taskkill/t/f/pidpid号Jar#jar包后......
  • JMeter在linux安装及运行
        JMeter在linux服务器安装   1、在服务器/opt或者其他目录下,新建文件夹:mkdirJMeter;把JMeter的压缩包放入到该路径下,若复制失败,可能是因为JMeter文件夹缺少操作权限,添加权限:chmod-R777JMeter,再次复制;   2、执行命令:unzip  apache-jmeter-5.2.1.zip,或者......
  • Linux_SSH免密随笔
    一、介绍SSH为 SecureShell的缩写,它是建立在应用层基础上的安全协议。SSH是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。利用SSH协议可以有效防止远程管理过程中的信息泄露问题。 SSH远程登录目标服务器有两种方式:①基于口令的安全认证:每次登录的时......