从pem文件追加pub键并使用另一个键保存在远程服务器

如果您需要添加另一个密钥并使用pem文件(在AWS EC2实例中很常见),则非常有用。
如果您在EC2实例中使用它,请记住禁用密码身份验证,因此您必须使用生成实例时生成的第一个密钥
.

0

linux命令: ssh-keygen -y -f user-key.pem | ssh user@host -i already_on_remote_server_key.pem 'cat >> ~/.ssh/authorized_keys' ~/.ssh/authorized_keys' >> 'cat already_on_remote_server_key.pem -i user@host ssh | user-key.pem -f -y ssh-keygen ssh-keygen -y -f user-key.pem | ssh user@host -i already_on_remote_server_key.pem 'cat >> ~/.ssh/authorized_keys'rootopen.com
linux命令: ssh-keygen -y -f user-key.pem | ssh user@host -i already_on_remote_server_key.pem 'cat >> ~/.ssh/authorized_keys' ~/.ssh/authorized_keys' >> 'cat already_on_remote_server_key.pem -i user@host ssh | user-key.pem -f -y ssh-keygen ssh-keygen -y -f user-key.pem | ssh user@host -i already_on_remote_server_key.pem 'cat >> ~/.ssh/authorized_keys'rootopen.com
vojg 2019-02-25 22:36:25
输出

评论

相关推荐

linux命令:ssh-keygen -y -f privatekey.pem > publickey.pem publickey.pem > privatekey.pem -f -y ssh-keygen ssh-keygen -y -f privatekey.pem > publickey.pemrootopen.com
linux命令:ssh-keygen -y -f privatekey.pem > publickey.pem publickey.pem > privatekey.pem -f -y ssh-keygen ssh-keygen -y -f privatekey.pem > publickey.pemrootopen.com
.

如果您必须通过本地端口隧道SSH并且它抱怨主机密钥不同,那么这很有用。比手动编辑文件要容易得多。

linux命令:ssh-keygen -R \[localhost\]:8022 \[localhost\]:8022 -R ssh-keygen ssh-keygen -R \[localhost\]:8022rootopen.com
linux命令:ssh-keygen -R \[localhost\]:8022 \[localhost\]:8022 -R ssh-keygen ssh-keygen -R \[localhost\]:8022rootopen.com
.

linux命令:ssh-keygen -i -f $sshkeysfile >> authorized_keys authorized_keys >> $sshkeysfile -f -i ssh-keygen ssh-keygen -i -f $sshkeysfile >> authorized_keysrootopen.com
linux命令:ssh-keygen -i -f $sshkeysfile >> authorized_keys authorized_keys >> $sshkeysfile -f -i ssh-keygen ssh-keygen -i -f $sshkeysfile >> authorized_keysrootopen.com
.

linux命令:ssh-keygen -l -f [pubkey] | awk '{print $2}' | tr -ds ':' '' | egrep -ie "[a-f0-9]{32}" "[a-f0-9]{32}" -ie egrep | '' ':' -ds tr | $2}' '{print awk | [pubkey] -f -l ssh-keygen ssh-keygen -l -f [pubkey] | awk '{print $2}' | tr -ds ':' '' | egrep -ie "[a-f0-9]{32}"rootopen.com
linux命令:ssh-keygen -l -f [pubkey] | awk '{print $2}' | tr -ds ':' '' | egrep -ie "[a-f0-9]{32}" "[a-f0-9]{32}" -ie egrep | '' ':' -ds tr | $2}' '{print awk | [pubkey] -f -l ssh-keygen ssh-keygen -l -f [pubkey] | awk '{print $2}' | tr -ds ':' '' | egrep -ie "[a-f0-9]{32}"rootopen.com
.

该命令序列允许简单设置(gasp!)无密码SSH登录。要小心,就好像你已经在本地机器上的〜/ .ssh目录中有一个SSH密钥对,那么ssh-keygen可能会覆盖它们。 ssh-copy-id将公钥复制到远程主机,并将其附加到远程帐户的〜/ .ssh / authorized_keys文件中。在尝试使用ssh时,如果您没有为密钥使用密码,远程shell会在调用ssh user @ host后不久出现。

linux命令:ssh-keygen; ssh-copy-id user@host; ssh user@host user@host ssh user@host; ssh-copy-id ssh-keygen; ssh-keygen; ssh-copy-id user@host; ssh user@hostrootopen.com
linux命令:ssh-keygen; ssh-copy-id user@host; ssh user@host user@host ssh user@host; ssh-copy-id ssh-keygen; ssh-keygen; ssh-copy-id user@host; ssh user@hostrootopen.com
.

放下联合和rtfm :)

linux命令:ssh-keygen -R hostname hostname -R ssh-keygen ssh-keygen -R hostnamerootopen.com
linux命令:ssh-keygen -R hostname hostname -R ssh-keygen ssh-keygen -R hostnamerootopen.com
.

如果您知道主机名并希望单独查找IP地址,您只需一步即可快速找到快捷方式。

linux命令:ssh-keygen -R `host hostname | cut -d " " -f 4` 4` -f " " -d cut | hostname `host -R ssh-keygen ssh-keygen -R `host hostname | cut -d " " -f 4`rootopen.com
linux命令:ssh-keygen -R `host hostname | cut -d " " -f 4` 4` -f " " -d cut | hostname `host -R ssh-keygen ssh-keygen -R `host hostname | cut -d " " -f 4`rootopen.com
.

获取服务器的fingerprints指纹,以便用户验证他们何时ssh进入。公钥密码的位置可能因发行版而异。fingerprints应该在带外提供。

linux命令:ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub && ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_dsa_key.pub -f -l ssh-keygen && /etc/ssh/ssh_host_rsa_key.pub -f -l ssh-keygen ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub && ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pubrootopen.com
linux命令:ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub && ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_dsa_key.pub -f -l ssh-keygen && /etc/ssh/ssh_host_rsa_key.pub -f -l ssh-keygen ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub && ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pubrootopen.com
.

如果您在openssh服务器端丢失了模块文件,则需要使用此命令生成新模块,然后测试生成的数字是否可以与ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidates一起使用

linux命令:ssh-keygen -G /tmp/moduli-2048.candidates -b 2048 2048 -b /tmp/moduli-2048.candidates -G ssh-keygen ssh-keygen -G /tmp/moduli-2048.candidates -b 2048rootopen.com
linux命令:ssh-keygen -G /tmp/moduli-2048.candidates -b 2048 2048 -b /tmp/moduli-2048.candidates -G ssh-keygen ssh-keygen -G /tmp/moduli-2048.candidates -b 2048rootopen.com
.

该命令测试命令ssh-keygen -G /tmp/moduli-2048.candidates -b 2048生成的模块文件。测试可以长时间取决于你的CPU功耗,大约5分钟到30分钟

linux命令:ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidates /tmp/moduli-2048.candidates -f moduli-2048 -T ssh-keygen ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidatesrootopen.com
linux命令:ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidates /tmp/moduli-2048.candidates -f moduli-2048 -T ssh-keygen ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidatesrootopen.com
.

在这种情况下,最好使用专用工具

linux命令:ssh-keygen -R <the_offending_host> <the_offending_host> -R ssh-keygen ssh-keygen -R <the_offending_host>rootopen.com
linux命令:ssh-keygen -R <the_offending_host> <the_offending_host> -R ssh-keygen ssh-keygen -R <the_offending_host>rootopen.com
.

使用密码保护您的秘密身份.OSX 10.6自动执行密钥转发,并可将密钥存储在密钥链中。对于其他操作系统,请使用ssh -A或在ssh_config中设置ForwardAgent以启用转发。然后使用ssh-agent / ssh-add。

linux命令:ssh-keygen -f ~/.ssh/id_rsa -p -p ~/.ssh/id_rsa -f ssh-keygen ssh-keygen -f ~/.ssh/id_rsa -prootopen.com
linux命令:ssh-keygen -f ~/.ssh/id_rsa -p -p ~/.ssh/id_rsa -f ssh-keygen ssh-keygen -f ~/.ssh/id_rsa -prootopen.com
.

将返回您在〜/ .ssh / known_hosts文件中包含的每个主机的SSH服务器密钥信息,包括密钥大小,密钥指纹,密钥IP地址或域名以及密钥类型。

linux命令:ssh-keygen -l -f ~/.ssh/known_hosts ~/.ssh/known_hosts -f -l ssh-keygen ssh-keygen -l -f ~/.ssh/known_hostsrootopen.com
linux命令:ssh-keygen -l -f ~/.ssh/known_hosts ~/.ssh/known_hosts -f -l ssh-keygen ssh-keygen -l -f ~/.ssh/known_hostsrootopen.com
.

linux命令:ssh-keygen -R hostname hostname -R ssh-keygen ssh-keygen -R hostnamerootopen.com
linux命令:ssh-keygen -R hostname hostname -R ssh-keygen ssh-keygen -R hostnamerootopen.com
.

linux命令:ssh-keygen ptaduri@c3pusas1 ptaduri@c3pusas1 ssh-keygen ssh-keygen ptaduri@c3pusas1rootopen.com
linux命令:ssh-keygen ptaduri@c3pusas1 ptaduri@c3pusas1 ssh-keygen ssh-keygen ptaduri@c3pusas1rootopen.com
.

现在在rsa.pub文件的末尾,有我们的评论,例如=“................. peXeuE0ytJgpQcXeR5aHlfLa8dAt0obasd hello @ world”

linux命令:ssh-keygen -C hello@world hello@world -C ssh-keygen ssh-keygen -C hello@worldrootopen.com
linux命令:ssh-keygen -C hello@world hello@world -C ssh-keygen ssh-keygen -C hello@worldrootopen.com
.

删除.ssh / known_hosts文件的主机

linux命令:ssh-keygen -R <thehost> <thehost> -R ssh-keygen ssh-keygen -R <thehost>rootopen.com
linux命令:ssh-keygen -R <thehost> <thehost> -R ssh-keygen ssh-keygen -R <thehost>rootopen.com
.

如果您知道主机名并希望单独查找IP地址,您只需一步即可快速找到快捷方式。

linux命令:ssh-keygen -R $(dig +short host.domain.tld) host.domain.tld) +short $(dig -R ssh-keygen ssh-keygen -R $(dig +short host.domain.tld)rootopen.com
linux命令:ssh-keygen -R $(dig +short host.domain.tld) host.domain.tld) +short $(dig -R ssh-keygen ssh-keygen -R $(dig +short host.domain.tld)rootopen.com
.

验证openssh密钥和打印校验和

linux命令:ssh-keygen -l -f [pubkey] | cut -d ' ' -f 2 | tr -ds '\n:' '' '' '\n:' -ds tr | 2 -f ' ' -d cut | [pubkey] -f -l ssh-keygen ssh-keygen -l -f [pubkey] | cut -d ' ' -f 2 | tr -ds '\n:' ''rootopen.com
linux命令:ssh-keygen -l -f [pubkey] | cut -d ' ' -f 2 | tr -ds '\n:' '' '' '\n:' -ds tr | 2 -f ' ' -d cut | [pubkey] -f -l ssh-keygen ssh-keygen -l -f [pubkey] | cut -d ' ' -f 2 | tr -ds '\n:' ''rootopen.com
.

生成使用dsa作为加密算法的ssh密钥对(public,private)

linux命令:ssh-keygen -t dsa -b 1024 1024 -b dsa -t ssh-keygen ssh-keygen -t dsa -b 1024rootopen.com
linux命令:ssh-keygen -t dsa -b 1024 1024 -b dsa -t ssh-keygen ssh-keygen -t dsa -b 1024rootopen.com
.
共收录0条命令行
这里是记录和分享命令行的地方, 所有命令行都可以进行评论、提交替代方案.

推荐
    热门命令