首页 > 其他分享 >13_配置免密登录

13_配置免密登录

时间:2023-10-11 16:22:06浏览次数:26  
标签:10.1 13 免密 22 登录 00 ssh root Oct

1.生成密钥对
[root@centos79 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
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:
SHA256:fnVf04u0NK2NkQHv8hU5yX0pKKrTR+04dr7IV8isk0s root@centos79
The keys randomart image is:
+---[RSA 2048]----+
|           .     |
|            + . =|
|         . . + Bo|
|        . o . = =|
|       .S.oooB.+o|
|      o.. o==oX.+|
|     o ..E+o.* o.|
|      . ===.     |
|         ++o.    |
+----[SHA256]-----+


# 一键生成密钥对
[root@centos1 .ssh]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
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:LNcQvqnGg3ImJWaf7g2mrnDZj0MfuEGdTqcy7RQ4Ces root@centos1
The keys randomart image is:
+---[RSA 2048]----+
|        .        |
|  .    . .       |
|   o + .o        |
|  . = =..=       |
| .+..*.+S .      |
| oE**+*+         |
|. =.XO=.         |
|.. Oo*o.         |
|.oo.+.o          |
+----[SHA256]-----+
2.访问记录查看

# 查看在线状态
[root@centos2 .ssh]# w
 22:07:52 up 6 min,  3 users,  load average: 0.03, 0.05, 0.04
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1                      22:02    5:52   0.02s  0.02s -bash
root     pts/0    10.1.1.1         22:06    0.00s  0.03s  0.00s w
root     pts/1    10.1.1.3         22:07   19.00s  0.01s  0.01s -bash

# 查看谁登录成功过
[root@centos2 ~]# last
root     pts/1        10.1.1.3         Tue Oct 10 22:07 - 22:08  (00:00)
root     pts/1        10.1.1.3         Tue Oct 10 22:07 - 22:07  (00:00)
root     pts/0        10.1.1.1         Tue Oct 10 22:06   still logged in
root     pts/0        10.1.1.1         Tue Oct 10 22:05 - 22:06  (00:00)


# 查看谁登录失败过
[root@centos2 ~]# lastb
root     ssh:notty    10.1.1.3         Tue Oct 10 22:07 - 22:07  (00:00)
root     ssh:notty    10.1.1.3         Tue Oct 10 22:07 - 22:07  (00:00)
main     ssh:notty    10.1.1.3         Tue Oct 10 20:12 - 20:12  (00:00)
main     ssh:notty    10.1.1.3         Tue Oct 10 20:11 - 20:11  (00:00)
main     ssh:notty    10.1.1.3         Tue Oct 10 20:11 - 20:11  (00:00)
root     tty1                          Mon Oct  9 11:05 - 11:05  (00:00)
root     tty1                          Sun Oct  8 11:34 - 11:34  (00:00)

btmp begins Sun Oct  8 11:34:44 2023
3.把自己的公钥发给对方 入侵
# 服务费微风
[root@centos1 .ssh]# ssh-copy-id [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/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
Warning: Permanently added '10.1.1.5' (ECDSA) to the list of known hosts.
[email protected] 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.

# 登录对方
ssh root@${IP}

标签:10.1,13,免密,22,登录,00,ssh,root,Oct
From: https://www.cnblogs.com/ckh2023/p/17757482.html

相关文章

  • P8313 [COCI2021-2022#4] Izbori
    \(\text{Links}\)原题传送门题意求给定序列中有多少个子区间满足众数出现次数严格大于区间长度的一半。题解题目要求满足条件的子区间,一个很直接的想法是每次固定左(右)端点,求有多少个右(左)可以与其匹配对答案造成贡献。那么考虑一个暴力做法:每次固定左端点,然后往后面一直扫,......
  • DELL R730 idrace web页面无法显示,可不重启服务器,ssh登录重启idrace服务
    故障现象:Dell服务器带外管理Idrace的web页面无法显示。处理过程:  无需冷启动服务器  ssh登录Dell服务器带外管理地址用户名与密码同为登录web页面账号密码  运行重启命令:racadmracreset  等待约2分钟后,Idrace带外管理web页面恢复正常显示,可正常登录。racadmrac......
  • 视频直播源码,AndroidStudio登录页面的切换
    视频直播源码,AndroidStudio登录页面的切换xml代码 <?xmlversion="1.0"encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  ......
  • SpringBootWeb登录认证 上
    案例-登录认证在前面的课程中,我们已经实现了部门管理、员工管理的基本功能,但是大家会发现,我们并没有登录,就直接访问到了Tlias智能学习辅助系统的后台。这是不安全的,所以我们今天的主题就是登录认证。最终我们要实现的效果就是用户必须登录之后,才可以访问后台系统中的功能。1.登......
  • SpringBootWeb登录认证上中
    2.2.2.2方案二-Session前面介绍的时候,我们提到Session,它是服务器端会话跟踪技术,所以它是存储在服务器端的。而Session的底层其实就是基于我们刚才所介绍的Cookie来实现的。获取Session如果我们现在要基于Session来进行会话跟踪,浏览器在第一次请求服务器的时候,我们就可......
  • SpringBootWeb登录认证下
    2.5拦截器Interceptor学习完了过滤器Filter之后,接下来我们继续学习拦截器Interseptor。拦截器我们主要分为三个方面进行讲解:介绍下什么是拦截器,并通过快速入门程序上手拦截器拦截器的使用细节通过拦截器Interceptor完成登录校验功能我们先学习第一块内容:拦截器快速入门2.5.1快速......
  • SpringBootWeb登录认证中下
    2.4过滤器Filter刚才通过浏览器的开发者工具,我们可以看到在后续的请求当中,都会在请求头中携带JWT令牌到服务端,而服务端需要统一拦截所有的请求,从而判断是否携带的有合法的JWT令牌。那怎么样来统一拦截到所有的请求校验令牌的有效性呢?这里我们会学习两种解决方案:Filter过滤器Inter......
  • window系统多用户登录软件——ASTER——终端共享器——网络终端机
        ===========================================  终端共享器、网络终端机      ......
  • [ARC130E] Increasing Minimumm
    [ARC130E]IncreasingMinimumm?考虑模拟一下题目中的过程,发现相当于将原序列按照初始值划分为若干个等价类,然后每次都会先合并等价类然后重排等价类中的所有数并加入\(I\)中。这样将\(I\)划分成了若干段。考虑假设我们一共划分出\(T\)个段,那么最终每个数的答案就是\(T\)......
  • android 13 指纹整理
    android13指纹整理术语缩略语英文全名中文解释TEETrustedExecutionEnvironment可信执行环境,存在于主CPU中的一块安全运行环境。CAClientApplication客户端应用,通常指运行在REE的应用TATrustedApplication可信应用,通常指运行在TEE环境的应用......