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. 09、const与extern在一起跨文件引用

    const与extern都属于属性一类. 两者加一起用需要注意的一点是,在多文件编译中,加入我们共用一个全局常量.一般的定义会是这样: A.cpp文件 const int gg_int = 100; ...

  2. HDU1862 - EXCEL排序

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1862 解题思路:结构体排序 #include <bits/stdc++.h> using ...

  3. mnist识别优化——使用新的fashion mnist进行模型训练

    今天通过论坛偶然知道,在mnist之后,还出现了一个旨在代替经典mnist数据集的Fashion MNIST,同mnist一样,它也是被用作深度学习程序的“hello world”,而且也是由70k张 ...

  4. ES6--函数的参数

    参数展开(扩展) 1.收集剩余的参数 function show(a, b, ...args) { console.log(a); console.log(b); console.log(args); ...

  5. Codeforces Round #620 (Div. 2) D

    构造一个排列,要求相邻之间的数满足给定的大小关系,然后构造出两个序列,一个序列是所有可能的序列中LIS最长的,一个所有可能的序列中LIS最短的 最短的构造方法:我们考虑所有单调递增的部分,可以发现要让 ...

  6. UVA12716-连续区间内反向寻因子法

    在涉及的题目中如果需要使用连续区间内的数据的因数,可以放弃使用%这种低效的方案,从因数的角度进行,UVA12716中对于代码的优化就利用了这个小技巧. 原题:https://vjudge.net/pr ...

  7. UVA10791-Minimum Sum LCM(唯一分解定理基本应用)

    原题:https://vjudge.net/problem/UVA-10791 基本思路:1.借助唯一分解定理分解数据.2.求和输出 知识点:1.筛法得素数 2.唯一分解定理模板代码 3.数论分析-唯 ...

  8. “/Reports”应用程序中的服务器错误。

    “/Reports”应用程序中的服务器错误. ----------------------------------------------------------------------------- ...

  9. 微信小程序调起支付API

    官方文档: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7 https://developers.weixin.q ...

  10. js - 除法

    取整数 1.丢弃小数部分,保留整数部分 js:parseInt(7/2) 2.向上取整,有小数就整数部分加1 js: Math.ceil(7/2) 3,四舍五入. js: Math.round(7/2 ...