栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在没有提示的情况下执行ssh-keygen

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在没有提示的情况下执行ssh-keygen

只需 使用一个空白通 使用

-N
标志:

ssh-keygen -t rsa -N ''

要覆盖密钥文件 (在此示例中

id_rsa
):

 ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa 2>/dev/null <<< y >/dev/null

ssh-keygen
手册 页:

  -N new_passphrase provides the new passphrase.  -q     silence ssh-keygen.  -f filename       specifies the filename of the key file.

逐步说明

$ ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/klashxx/.ssh/id_rsa):

1 )为避免输入密钥,请使用

-f

$ ssh-keygen -t rsa -f ~/.ssh/id_rsaGenerating public/private rsa key pair./home/klashxx/.ssh/id_rsa already exists.Overwrite (y/n)?

2 )现在我们需要对 覆盖问题 自动回答“ y ” (让我们为该作业使用
here字符串
): __
__

$ ssh-keygen -t rsa -f ~/.ssh/id_rsa <<< yGenerating public/private rsa key pair./home/klashxx/.ssh/id_rsa already exists.Overwrite (y/n)? Enter passphrase (empty for no passphrase):

3 )最后,我们将使用该

-N
标志输入无效通行证:

$ ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa <<< yGenerating public/private rsa key pair./home/klashxx/.ssh/id_rsa already exists.Overwrite (y/n)? Your identification has been saved in /home/klashxx/.ssh/id_rsa.Your public key has been saved in /home/klashxx/.ssh/id_rsa.pub.The key fingerprint is:SHA256:Xo0t6caMB/8TSsigxfY28JIfqYjyqxRZrFrPncx5yiU klashxx@serverThe key's randomart image is:+---[RSA 2048]----+|      ||  .   ||   o .||  +   *    =     || +.  + BSo= o    ||...o.+o+XO...    ||.. .o.E==+B. .   ||o . ...=.o...    ||.+o.  o     ..   |+----[SHA256]-----+

4多余的球 ,清理输出,只需检查返回码:

$ ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa 2>/dev/null <<< y >/dev/null$ echo $?0

荣誉

@ lukasz-dynowski,@ redochka,@ mellow-yellow和该线程中的其他成员。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/412651.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号