美文网首页
安全之opssh篇

安全之opssh篇

作者: 尘曦的雨 | 来源:发表于2017-07-23 14:49 被阅读60次

基于key验证
1.生成key的密钥对

ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):  使用算法默认rsa算法
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y由于之前做过key这里是问是否覆盖
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:
a5:2f:5d:1e:02:de:44:7c:99:7a:ee:ab:d7:e6:73:c8 root@chenxi
The key's randomart image is:
+--[ RSA 2048]----+
|         ..  o   |
|         .. +    |
|        . oo     |
|       . *. .    |
|        S ooo    |
|         o +..   |
|        . o..o . |
|         .  o E .|
|          .o.+.o |
+-----------------+
[root@chenxi ~]# 

把公钥传入另一台主机 root的家目录下的.ssh/目录

[root@chenxi ~]# ssh-copy-id -i .ssh/id_rsa.pub 172.16.251.154
/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
root@172.16.251.154's password: 172.16.251.154主机root 输入密码

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '172.16.251.154'"
and check to make sure that only the key(s) you wanted were added.

[root@chenxi ~]# 

使用key登陆172.16.251.154 主机

[root@chenxi ~]# ssh 172.16.251.154
Enter passphrase for key '/root/.ssh/id_rsa':  输入密钥的对称加密密码,每次登陆都需要登陆
Last failed login: Wed Jul 19 15:31:15 CST 2017 from 172.16.251.203 on ssh:notty
There were 2 failed login attempts since the last successful login.
Last login: Wed Jul 19 15:10:58 2017 from 172.16.250.137
[root@centos7 ~]# 

使用ssh程序来保证

[root@chenxi ~]# ssh-agent bash
[root@chenxi ~]# ssh-add
Enter passphrase for /root/.ssh/id_rsa: 
Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)

相关文章

  • 安全之opssh篇

    基于key验证1.生成key的密钥对 把公钥传入另一台主机 root的家目录下的.ssh/目录 使用key登陆17...

  • 2018-09-04

    安全驾驶之汽车停车技巧篇 --------------------------------------------...

  • 安全之加密篇

    密钥介绍 常见的数据安全的两大护法1 对称加密: 简单得说加密数据时使用的钥匙与解密时使用的必须是同一把钥匙2非对...

  • 囤货之安全座椅篇

    我家小宝贝三个月啦,趁着天气放晴去外婆家,之前偷懒,安全座椅一直没确定下来。到底买年龄跨度小的还是大的,所以每次出...

  • spring boot微服务之https调用

    前言 接上一篇的安全加固之https http://www.jianshu.com/p/46cad1265561 ...

  • Android 开发中的若干安全问题 之 Activity篇(转

    Android 开发中的若干安全问题 之 Activity篇 发布时间:2016-01-08 10:13 | 作者...

  • 小白学安全之HTTPS篇

    也许一个时代来临 2018年7月,Google即将发布新版本Chrome 68,在这个版本中,Chrome会将所有...

  • 公交安全驾驶之规劝篇:

    道理你们比我懂,说的其实很普通。 谨慎认真没有错,保你人车都太平。 不管一扛和二扛,还是三星与四星。 超车变道胡球...

  • 安全测试之burpsuite基础篇

    Burp Suite是一个集成化的渗透测试工具,它集合了多种渗透测试组件,使我们自动化地或手工地能更好的完成对we...

  • iOS应用安全之代码混淆

    iOS应用安全之代码混淆iOS应用安全之代码混淆

网友评论

      本文标题:安全之opssh篇

      本文链接:https://www.haomeiwen.com/subject/pznhkxtx.html