自动执行“输入"操作. bash脚本生成ssh密钥的按键 [英] Automating "enter" keypresses for bash script generating ssh keys

查看:136
本文介绍了自动执行“输入"操作. bash脚本生成ssh密钥的按键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建只运行ssh-keygen -t rsa的脚本.但是如何传递给它3次进入?

I would like to create script, which simply runs ssh-keygen -t rsa. But how to pass to it 3 times enter?

推荐答案

尝试:

ssh-keygen -t rsa -N "" -f my.key

-N ""告诉它使用一个空密码短语(与交互式脚本中的两个enter相同)

-N "" tells it to use an empty passphrase (the same as two of the enters in an interactive script)

-f my.key告诉它将密钥存储到my.key中(根据您的需要进行更改).

-f my.key tells it to store the key into my.key (change as you see fit).

整个过程运行而无需提供任何回车键:)

The whole thing runs without you needing to supply any enter keys :)

要发送回车,请输入交互式脚本:

To send enters to an interactive script:

echo -e "\n\n\n" | ssh-keygen -t rsa

这篇关于自动执行“输入"操作. bash脚本生成ssh密钥的按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆