sh SSH密钥和密码短语

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh SSH密钥和密码短语相关的知识,希望对你有一定的参考价值。

$ sudo apt-get install sshpass
$ sshpass -p your_password ssh user@hostname

- or -
$ sshpass -p your_password ssh -l user_name 192.168.XXX.XXX
Don't use a password. Generate a passphraseless SSH key and push it to your VM.

If you already have an SSH key, you can skip this step… Just hit Enter for the key and both passphrases:

$ ssh-keygen -t rsa -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
Copy your keys to the target server:

$ ssh-copy-id id@server
id@server's password: 
Now try logging into the machine, with ssh 'id@server', and check in:

.ssh/authorized_keys
to make sure we haven’t added extra keys that you weren’t expecting.

Finally check logging in…

$ ssh id@server

id@server:~$ 
You may also want to look into using ssh-agent if you want to try keeping your
keys protected with a passphrase.

以上是关于sh SSH密钥和密码短语的主要内容,如果未能解决你的问题,请参考以下文章

使用密码短语(如 SSH 密钥)存储 Github / Gitea 身份验证令牌

如何输入 Git SSH 密钥的密码?

google关于ssh key的解释(转)转的google的wiki的

sh 使用用户名和密码将公共ssh密钥上传到gitlab

sh 将密码添加到SSH密钥

sh 将SSH密钥添加到代理。此步骤也可用于避免在执行git push / pull时输入SSH密码