三步搞定ssh无密码登录

配置RSA密钥使用ssh协议登录远程服务器 背景: 连接工具Xshell 6 目标服务器系统centOS7.3 本地系统windows 关于SSH服务器搭建 一、配置远程连接 1、ssh配置 //打开ssh配置文件 vi /etc/ssh/ssh_config 按需配置,也可关闭root用户登录,将权限所属用户改为普通用户进行登录 #关闭密码登录 PasswordAuthentication no #允许root认证登录 PermitRo... 阅读详情

You can login to a remote Linux server without entering password in 3 simple steps using ssky-keygen and ssh-copy-id as explained in this article.

ssh-keygen creates the public and private keys. ssh-copy-idcopies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys.

This article also explains 3 minor annoyances of using ssh-copy-id and how to use ssh-copy-id along with ssh-agent.

Step 1: Create public and private keys using ssh-key-gen on local-host

jsmith@local-host$ [Note: You are on local-host here]

jsmith@local-host$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/jsmith/.ssh/id_rsa.
Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub.
The key fingerprint is:
33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 jsmith@local-host

Step 2: Copy the public key to remote-host using ssh-copy-id

jsmith@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
jsmith@remote-host's password:
Now try logging into the machine, with "ssh 'remote-host'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.

Step 3: Login to remote-host without entering the password

jsmith@local-host$ ssh remote-host
Last login: Sun Nov 16 17:22:33 2008 from 192.168.1.2
[Note: SSH did not ask for password.]

jsmith@remote-host$ [Note: You are on remote-host here]


The above 3 simple steps should get the job done in most cases.

We also discussed earlier in detail about performing SSH and SCP from openSSH to openSSH without entering password.

If you are using SSH2, we discussed earlier about performing SSH and SCP without password from SSH2 to SSH2 , from OpenSSH to SSH2 and from SSH2 to OpenSSH.

Using ssh-copy-id along with the ssh-add/ssh-agent

When no value is passed for the option -i and If ~/.ssh/identity.pub is not available, ssh-copy-id will display the following error message.

jsmith@local-host$ ssh-copy-id -i remote-host
/usr/bin/ssh-copy-id: ERROR: No identities found


If you have loaded keys to the ssh-agent using the ssh-add, then ssh-copy-id will get the keys from the ssh-agentto copy to the remote-host. i.e, it copies the keys provided by ssh-add -L command to the remote-host, when you don’t pass option -i to the ssh-copy-id.

jsmith@local-host$ ssh-agent $SHELL

jsmith@local-host$ ssh-add -L
The agent has no identities.

jsmith@local-host$ ssh-add
Identity added: /home/jsmith/.ssh/id_rsa (/home/jsmith/.ssh/id_rsa)

jsmith@local-host$ ssh-add -L
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAsJIEILxftj8aSxMa3d8t6JvM79DyBV
aHrtPhTYpq7kIEMUNzApnyxsHpH1tQ/Ow== /home/jsmith/.ssh/id_rsa

jsmith@local-host$ ssh-copy-id -i remote-host
jsmith@remote-host's password:
Now try logging into the machine, with "ssh 'remote-host'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.
[Note: This has added the key displayed by ssh-add -L]

Three Minor Annoyances of ssh-copy-id

Following are few minor annoyances of the ssh-copy-id.

  1. Default public key: ssh-copy-id uses ~/.ssh/identity.pub as the default public key file (i.e when no value is passed to option -i). Instead, I wish it uses id_dsa.pub, or id_rsa.pub, or identity.pub as default keys. i.e If any one of them exist, it should copy that to the remote-host. If two or three of them exist, it should copy identity.pub as default.
  2. The agent has no identities: When the ssh-agent is running and the ssh-add -L returns “The agent has no identities” (i.e no keys are added to the ssh-agent), the ssh-copy-id will still copy the message “The agent has no identities” to the remote-host’s authorized_keys entry.
  3. Duplicate entry in authorized_keys: I wish ssh-copy-id validates duplicate entry on the remote-host’s authorized_keys. If you execute ssh-copy-id multiple times on the local-host, it will keep appending the same key on the remote-host’s authorized_keys file without checking for duplicates. Even with duplicate entries everything works as expected. But, I would like to have my authorized_keys file clutter free.
LTR-390UV-01对比VEML6075:5个真实项目中的选型避坑指南 本文对比了LTR-390UV-01和VEML6075两款环境光传感器在5个真实项目中的表现,提供了选型避坑指南。通过智能手环、农业温室、紫外线消毒柜等场景的实测数据,分析了动态范围、抗干扰性、温度稳定性等关键差异,帮助开发者在成本与性能间做出最优选择。 阅读详情

相关推荐

告别DLTS的模糊地带:手把手教你用拉普拉斯深能级瞬态光谱(LDLTS)精准揪出半导体缺陷

本文详细介绍了拉普拉斯深能级瞬态光谱(LDLTS)技术在半导体缺陷检测中的高分辨率解决方案。相比传统DLTS,LDLTS通过拉普拉斯变换和正则化算法,将分辨率提升至1meV,有效解析复杂重叠缺陷谱,适用于硅、GaN等材料的精确缺陷分析。文章涵盖LDLTS原理、系统搭建、测量流程及工业应用案例,为半导体工艺优化提供强大工具。

weixin_29238147的博客 193

tabby 创建ssh远程配置提示:Timed out while waiting for handshake

SSH ! Agent auth selected, but no running agent is detected SSH Host key fingerprint: SSH ecdsa-sha2-nistp256 41Ti***= X Timed out while waiting for handshake SSH X Remote rejected opening a shell channel: Error: Not connected

Aidiying的博客 8834

Rasa Core开发指南

文章目录1. Rasa Core简介1.1 Rasa Core消息处理流程1.2 安装Rasa Core2. Dialogue模型训练2.1 Story样本数据2.2 Domain2.2.0 intents2.2.1 actions2.2.2 templates2.2.3 entities2.2.4 slots3 .训练和使用对话模型3.1 训练对话模型3.2 使用对话模型4. 搭建CustomA...

老蒋也疯狂 1万+

Tabby 突然无法连接ssh解决

折腾很久,发现把这个【连接时校验主机密钥】选项关闭就ok了.对比xshell是能正常连接的,所以不是服务器问题.以前用的好好的tabby某日突然连不上ssh了,

JISHUQIANJIA的博客 6288

干法刻蚀工艺进阶:如何通过调节DC自偏压优化刻蚀速率和各向异性

本文深入探讨了干法刻蚀工艺中DC自偏压的精细调控艺术。DC自偏压是影响刻蚀速率和各向异性的关键因素,文章通过实战案例,详细分析了如何通过调节射频功率、频率、腔室压力及气体成分等参数,间接而有效地控制DC自偏压,从而优化高深宽比硅沟槽等复杂结构的刻蚀效果,实现工艺性能的精准提升。

weixin_28308325的博客 326

ubuntu:E: 无法定位软件包yum解决方法

如果出现以下问题,则需要更新yum源 yum源位于/etc/apt/sources.list yum源更新的网站有 清华大学开源镜像 中科大开源镜像 1.此处更新yum源的时候先备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo gedit /etc/apt/sources.list 将更新源替换成上面符合版本系列号 我用的版本号为20.04 # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释

码农研究僧的博客 1万+

Linux——ssh远程连接常见报错问题及解决方案

我们在ssh远程连接其他主机的时候经常会出现以下界面的报错 进入到/home/kiosk/.ssh目录下,并编辑known hosts文件 将第一行内容删掉 删除效果如下 重新连接则可以成功连接 ...

Treasured ——的博客 7590

【Python基础】FastAPI 从入门到项目实战操作详解

【Python基础】FastAPI从入门到使用实战操作详解

congge_study的博客 437

记录一次使用Tabby终端远程连接Ubuntu出现的无字段补全以及高亮提示的问题

然而,查阅资料显示使用 ssh进行无密码登录的自动化脚本中,可能会关闭 $PS1 的显示,以避免在日志中留下过多的信息。​综上所述不难看出,可能是tabby在ssh agent服务异常时启动一种ssh无密码自动登录脚本导致关闭了$PS1的显示,从而导致tabby终端没有高亮提示以及字段提示。​当tabby进行ssh无密码登录时发现选择了ssh agent服务,但是未检测到运行中的ssh agent时,tabby使用已保存的私钥进行身份验证。

2301_80073818的博客 2691

FanucROBOGUIDE软件二次开发:使用ROBOGUIDEAPI进行编程

菜单栏:位于界面顶部,提供文件、编辑、视图、插入、格式、工具、窗口和帮助等选项。工具栏:包含常用的工具按钮,如新建、打开、保存、运行、停止、机器人控制等。工作站视图:显示工作站的3D模型,用户可以在这里放置机器人、工件、工具和其他设备。机器人控制面板:用于控制机器人运动,包括手动移动、程序编辑和运行。程序编辑器:在这里可以编写和编辑机器人程序,支持Fanuc的R-30iB Plus和R-30iB控制柜的程序格式。状态栏:显示当前工作站的状态信息,如机器人位置、程序状态等。

kkchenjj的博客 1408

流体仿真软件:COMSOL Multiphysics二次开发_(3).流体仿真基础理论

流体仿真基础理论包括流体的基本性质、流体运动方程、边界条件、初始条件、湍流模型和网格生成等。在使用COMSOL Multiphysics进行流体仿真时,正确设置这些参数和条件是获得准确仿真结果的关键。通过实际应用案例,可以更好地理解如何在COMSOL中进行流体仿真,并提取和分析仿真结果。希望本文对流体仿真初学者和从业人员有所帮助。

kkchenjj的博客 1341

SSh Agent admitted failure to sign using the key

配置ssh免密码登录时遇到的错误 解決方式 使用 ssh-add 指令将私 加进来 在用户home目录下 ssh-add .ssh/id_rsa 可是我又遇到了错误 “Could not open a connection to your authentication agent.” 解决方法 用户家目录下 ssh-agent bash –login -i

csdn问鼎 375

5. SAP UI5 视图控制器(Controller)初探

本教程的前一个步骤也就是第四个步骤,我们了解了 SAP UI5 XML 视图的使用方法。在该步骤里,我们在 XML 视图里声明了一个 Text 控件实例,该控件位于 sap.m 这个命名空间内。 本步骤会继续接触 SAP UI5 MVC 框架中三大基石的另一块:C - Controller,即控制器。 先看看本步骤完成之后,我们得到的 SAP UI5 应用能实现一个什么样的效果。 访问如下 url: http://localhost:8080/webapp/index.html 能看到一个 Say Hell

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 4595

ubuntu 中ssh无密码配置 ,hadoop节点之间无密码登录

<br /> 今天在搭建hadoop环境配置的时候,需要ssh无密码登录,费了九牛二虎之力,终于搞定了。<br />  首先,不同的linux操作系统,可能之间的命令有一些少许的不同,我的操作系统是ubuntu,所以把我所搞的记录下来。<br />1、hadoop02@ubuntuserver2:/root$ ssh-keygen -t rsa  命令,出现一下结果,我一直按Enter,按到最后,<br />Generating public/private rsa key pair. Enter fil

老衣的专栏 1万+

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

linux下怎么设置无密码登录,如何设置 Ubuntu 14.04 的 SSH 无密码登录

大家好,今天我来向大家介绍如何在 Ubuntu 14.04 上设置 SSH 的无密码登录功能。仅在工作站上有正确的(公私)密钥对以供匹配时SSH服务端才会允许你登录,反之访问将不会被允许。正常情况下,我们需要连上SSH的控制台输入用户名及其密码才行。如果两者全部正确,我们就可以访问,反之访问被服务端拒绝。不过相比而言还有一种比用密码更安全的登录方式,我们可以在登录SSH时通过加密密钥进行无密码登录...

weixin_29374899的博客 378

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

配置ssh无密码/免密码登录(远程linux服务器)

如果没有配置ssh无密码登录 每次都要输密码 首先我们输入 ssh-keygen -t rsa #之后一路回车 就会生成.ssh隐藏文件夹 id_rsa是私钥 id_rsa是公钥 know_hosts中就是hadoop000 如果想让它能使用的话,要把公钥写到一个文件里去,authorized_keys cat id_rsa.pub >> authorized_keys 更改一下authorized_keys文件的权限 chmod 600...

hxxjxw的博客 3020

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

ssh无密码登录,两步搞定

最近研究hadoop,hadoop需要机器直接无秘密登录,折腾了好久,终于找到一个比较简单有效的方法,记录下来。 现在有两台机器,主机名分别是master,slave1 1.在master端生成密钥对:   ssh-keygen -t rsa 一路回车 2.传到slave1上   ssh-copy-id -i  ~/.ssh/id_rsa.pub hadoop@slave1

qyl445的专栏 1174

本地工具无密码登录linux,设置ssh无密码登录linux服务器的方法,

设置ssh无密码登录linux服务器的方法,每次登录测试服务器,ssh登录总是需要输入密码。登录的少还行,登录的多了,多一行命令都是多余的。rsa认证登录方式制作密钥对在客户端(本地机器)终端下输入以下命令ssh-keygen -t [rsa|dsa]rsa和dsa代表不同的算法例如:ssh-keygen -t rsa一直回车就对了(不用设置密码)将会生成密钥文件和私钥文件 id_rsa,id_r...

weixin_33047553的博客 177

linux服务器无密码登录不了,设置ssh无密码登录linux服务器的方法

每次登录测试服务器,ssh登录总是需要输入密码。登录的少还行,登录的多了,多一行命令都是多余的。rsa认证登录方式制作密钥对在客户端(本地机器)终端下输入以下命令ssh-keygen -t [rsa|dsa]rsa和dsa代表不同的算法例如:ssh-keygen -t rsa一直回车就对了(不用设置密码)将会生成密钥文件和私钥文件 id_rsa,id_rsa.pub(如果用dsa则生成id_dsa...

weixin_39959569的博客 188

SSH的无密码登录

    在不同的服务器之间配置ssh的无密码登录是相当普及的事情了,有关此的文章网上相当多。在此记录下前几天碰到的一件事情。    正常的两台服务器,一直ssh无密码登录用的挺好,突然间让输入帐号密码了,使用ssh -v 查看时发现RAS、DSA等非对称密钥全都失效了,最后选择了原始的密码匹配的方式。以前碰到过类似的问题,发现~/.ssh/目录和其下相关的密钥文件的权限过高,修改为正常值,结果还是

barfoo的专栏 811

SSH 无密码登陆Linux

使用下例中ssky-keygen和ssh-copy-id,仅需通过3个步骤的简单设置而无需输入密码就能登录远程Linux主机。  ssh-keygen 创建公钥和密钥。  ssh-copy-id 把本地主机的公钥复制到远程主机的authorized_keys文件上。 ssh-copy-id 也会给远程主机的用户主目录(home)和~/.ssh, 和~/.ssh/authorized_ke

6372

SSH Without a Password(SSH无密码登录)

主要用于建立自己使用的cluster和个人PC之间的登录。 此外根据个人经验,SSH无密码登录在配置分布式系统(例如Hadoop和parallel databases)时往往都是第一个步骤。(除非配置的是单机盘,用IP地址处用localhost就可以搞定)。网上搜了集中方法,觉得这种方法是最好用的。 The following steps can be used to ssh from

┅☆心随风飞 1421

ssh 免密登录

linux 配置ssh免密登录: 说明:ssh通过远程登录的安全外壳有来哦那个中身份认证机制: ——用户名+密码 ——密钥登录 环境介绍: host1:156.3.203.128 host2:156.3.203.251 1.在host1主机下生成公钥/私钥对 执行以下命令,一直回车 [root@l...

y805805的博客 249

如何设置 Ubuntu14.04 的 SSH 无密码登录

如何设置 Ubuntu14.04 的 SSH 无密码登录 大家好,今天我来向大家介绍如何在 Ubuntu12.04 上设置 SSH 的无密码登录功能。仅在工作站上有正确的(公私)密钥对以供匹配时SSH服务端才会允许你登录,反之访问将不会被允许。 正常情况下,我们需要连上SSH的控制台输入用户名及其密码才行。如果两者全部正确,我们就可以访问,反之访问被服...

weixin_34329187的博客 177

【windows 11 配置 SSH服务器,修改端口和配置密钥登录】

如果你windows 11没有公网IP,也想访问家里的windows 11电脑,那你就和我一样。sshd这种服务只有我们这些码农才会需要的,哎,如果你又嫌弃人家的服务贵,那么可以考虑找我了解一下比较经济的解决方案哈~~~88先啦。在windws 11中,打开“设置”,搜索“可用功能”,看到“添加可用功能”。不想敲代码,就使用services.msc找到sshd的服务行,右键点击运行服务。由于我们已经运行了一次SSHD的服务了,所以它已经自动生成了一堆密钥了!路径,用管理员模式打开文本编辑器,然后打开。

qq_42944545的博客 5268

配置ssh免密码登录

配置ssh免密码登录是让各节点能自动通过安全认证,不影响正常通讯。 安装ssh有两种方式: 在ubuntu上在线安装 执行命令 $sudo apt-get install ssh $sudo apt-get update 离线安装 在网上下载离线包,拷贝到ubuntu中按照离线包中的安装说明在本地进行安装 然后确认sshserver是否启动了: $ ps -e | gre...

沐雨金鳞 600
上一篇: 此仓库未被更新,仍然使用以前的索引文件。GPG
下一篇: win8 安装
张征宇
博客等级 码龄14年 4粉丝 8原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值