1、在终端输入 cd ~/.ssh/

vi config

输入服务器的用户名和密码

souche@kickseed:~/.ssh$ cat config
# 这是跳板机的配置,给跳板机的 IP 起个别名: jump_machine, 用户名: owen
Host feature
HostName .III.III.III
User XXX

2、生成 rsa 公钥和私钥: ssh-keygen -t rsa

tip:如果ssh的目录下面已经有公钥,就不用生成了

souche@kickseed:~/.ssh$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/souche/.ssh/id_rsa): 1HyKxJHtKz
1HyKxJHtKz already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in 1HyKxJHtKz.
Your public key has been saved in 1HyKxJHtKz.pub.
The key fingerprint is:
SHA256:PRQmfxrHWuWM5QgqTwd3OIsD8gPq70mf8JCzerVPzw8 souche@kickseed
The key's randomart image is:
+---[RSA ]----+
| o =.. o |
| o . Bo= O |
| . +..o.=oB + |
| . o+o+.B |
| . .S.= |
| . .. . |
| .*. .. E |
| .oO.o o . |
| .++ +.. o.. |
+----[SHA256]-----+
souche@kickseed:~/.ssh$

3、 ssh-copy-id -i    密钥文件   用户别名@服务器别名

souche@kickseed:~/.ssh$ ssh-copy-id -i id_rsa.pub  souche@feature
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "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: key(s) remain to be installed -- if you are prompted now it is to install the new keys
souche@172.17.41.58's password: Number of key(s) added: Now try logging into the machine, with: "ssh 'souche@feature'"
and check to make sure that only the key(s) you wanted were added. souche@kickseed:~/.ssh$ ssh-copy-id -i id_rsa.pub souche@eva

每天一个linux命令--ssh的host配置用户名密码的更多相关文章

  1. N天学习一个linux命令之scp

    用途 通过ssh通道,不同主机之间复制文件 用法 scp [options] [user@host:]file1 [user2@host2:]file2 常用参数 -1使用 ssh 1协议 -2使用s ...

  2. 每天一个linux命令(45)--telnet命令

    每天一个Linux命令,今天是网络命令中的Telnet. Telnet 命令通常用来远程登录,Telnet 程序是基于 Telnet 协议的远程登录客户端程序.Telnet 协议是TCP/IP协议族中 ...

  3. 64个命令,每天一个linux命令目录, shutdown,tee,rcp,

    每天一个linux命令目录 开始详细系统的学习linux常用命令,坚持每天一个命令,所以这个系列为每天一个linux命令.学习的主要参考资料为: 1.<鸟哥的linux私房菜> 2.htt ...

  4. 每天一个linux命令(49):at命令   atrm删除作业,由作业号标识。

    atq命令 例如:从现在起三天后的下午四点运行作业at 4pm + 3 days:在July 31上午十点运行作业at 10am July 31:明天上午一点运行作业at 1am tomorrow. ...

  5. (5)ps详解 (每周一个linux命令系列)

    (5)ps详解 (每周一个linux命令系列) linux命令 ps详解 引言:今天的命令是用来看进程状态的ps命令 ps 我们先看man ps ps - report a snapshot of t ...

  6. (4)top详解 (每周一个linux命令系列)

    (4)top详解 (每周一个linux命令系列) linux命令 top详解 引言:今天的命令是用来看cpu信息的top top 我们先看man top top - display Linux pro ...

  7. (3)lscpu详解 (每周一个linux命令系列)

    (3)lscpu详解 (每周一个linux命令系列) linux命令 lscpu详解 引言:今天的命令是用来看cpu信息的lscpu lscpu 我们先看man lscpu display infor ...

  8. N天学习一个Linux命令之帮助命令:man

    前言 工作中每天都在使用常用的命令和非常用的命令,忘记了用法或者参数,都会bing一下,然后如此循环.一直没有真正的系统的深入的去了解命令的用法,我决定打破它.以前看到有人,每天学习一个linux命令 ...

  9. 每天一个Linux命令:find(20)

    find find命令在目录结构中搜索文件,并执行指定的操作.Linux下find命令提供了相当多的查找条件,功能很强大.由于find具有强大的功能,所以它的选项也很多,其中大部分选项都值得我们花时间 ...

随机推荐

  1. python 3.6 安装 opencv 3.4

    一种说法是,到opencv官网下载相应的版本opencv,解压,把cv2.pyd放到 python安装文件夹下的\Lib\site-packages里即可, 此时import cv2即可成功 我的没有 ...

  2. A Simple Problem with Integers POJ - 3468 线段树区间修改+区间查询

    //add,懒标记,给以当前节点为根的子树中的每一个点加上add(不包含根节点) // #include <cstdio> #include <cstring> #includ ...

  3. 在iOS下-input[disabled] 颜色变浅兼容&& input[readonly]仍可获取焦点解决方法

    目标:在写input输入框时,想让其只读不写. 环境:在iPhone上 本来用的时readonly,可是readonly,居然可以获取焦点,不能弹出键盘:安卓手机完全木有问题,所以去用了disable ...

  4. Python标准库之logging模块

    很多程序都有记录日志的需求,并且日志中包含的信息即有正常的程序访问日志,还可能有错误.警告等信息输出,python的logging模块提供了标准的日志接口,你可以通过它存储各种格式的日志,loggin ...

  5. 通过ssh-copy-id免密码连接Linux主机

    Login Raspberry Pi without passcode via ssh-copy-id Generate public key $ ssh-keygen -t rsa Upload p ...

  6. FatMouse and Cheese HDU - 1078 dp

    #include<cstdio> #include<iostream> #include<cstring> using namespace std; int n,k ...

  7. UVa - 12050 Palindrome Numbers (二分)

    Solve the equation: p ∗ e −x + q ∗ sin(x) + r ∗ cos(x) + s ∗ tan(x) + t ∗ x 2 + u = 0 where 0 ≤ x ≤ ...

  8. 基于 Ant Desigin 的后台管理项目打包优化实践

    背景 按照 Ant Design 官网用 React 脚手构建的后台项目,刚接手项目的时候大概30条路由左右,我的用的机子是 Mac 8G 内存,打包完成需要耗时2分钟左右,决定优化一下. 项目技术栈 ...

  9. Spring boot unable to determine jdbc url from datasouce

    1. 首先删除 @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class}) 2. 在配置文件里添加完整的dataso ...

  10. Selenium3+python自动化011-unittest生成测试报告(HTMLTestRunner)

    批量执行完用例后,生成的测试报告是文本形式的,不够直观,为了更好的展示测试报告,最好是生成HTML格式的. unittest里面是不能生成html格式报告的,需要导入一个第三方的模块:HTMLTest ...