标签: ssh-keys

如何处理多个 ssh 密钥

我在两个 github 帐户中为不同的项目创建了两个 ssh 密钥。一个是我的帐户,另一个是公司帐户 github。我使用不同的 ssh-key 从事项目。所以每次当我打开不同的项目时我都会输入这个命令。

eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa_my_git
Run Code Online (Sandbox Code Playgroud)
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa_company_git
Run Code Online (Sandbox Code Playgroud)

我希望通过向项目或电脑添加配置文件或使用其他方式来避免每次都输入此内容。

git ssh ssh-keys

1
推荐指数
1
解决办法
5056
查看次数

将 SSH 私钥更改为现有私钥

我必须对我的 Mac 进行出厂重置,现在我正在重新配置我需要的所有开发内容,例如 Ruby/Rails 等...

下一步是配置 git,我的问题是关于我的 ssh 密钥:

根据我之前的配置,我将我的私有 ssh 密钥保存在一个文本文件中(我不知道这在安全性方面是否是一个好主意,但这不是重点),只需从我的终端复制它并将其粘贴到一个文本文件中。

我想再次使用该私有 ssh 密钥,而不是创建新的公共和私有密钥。我怎样才能做到这一点?我是否必须创建一个新的,然后以某种方式替换我之前保存的那个?如果是这样,怎么办?

如果您可以非常具体地回答,我们将非常感激,因为我对这个主题并不熟悉。

预先非常感谢!

macos ssh ruby-on-rails ssh-keys gitlab

1
推荐指数
1
解决办法
3797
查看次数

GIT_SSH/GIT_SSH_COMMAND/core.sshCommand 之间的区别?

我目前正在使用 GIT_SSH_COMMAND 进行项目,但想了解 GIT_SSH/GIT_SSH_COMMAND/core.sshCommand 之间的核心区别,哪个更好用?

git ssh ssh-keys

1
推荐指数
1
解决办法
1005
查看次数

连接到 Node jenkins(ssh 错误:服务器拒绝 1 私有)

配置的节点:

Launch method: Launchagents via SSH
Host: host
Credentials: added a new one by specifying username and Private key
Host Key Verification Strategy: Not verifying (The error does not differ when choosing a different value)
Run Code Online (Sandbox Code Playgroud)

当我尝试连接时,出现错误:

[08/24/22 14:39:14] [SSH] Opening SSH connection to host:22.
[08/24/22 14:39:14] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
ERROR: Server rejected the 1 private key(s) for cred_name (credentialId:cred_name/method:publickey)
ERROR: Failed to authenticate as cred_name with …
Run Code Online (Sandbox Code Playgroud)

ssh ssh-keys jenkins

1
推荐指数
1
解决办法
3191
查看次数

GitHub 使用错误的 SSH 密钥

我有两个使用 ssh 密钥设置的 GitHub 帐户,一个是个人帐户,一个是企业帐户。

我有一个 ssh 配置文件,如下所示:

# * GitHub CKO SSH Key
Host github-enterprise
  HostName github.com
  AddKeysToAgent yes
  UseKeychain yes
  User git
  IdentityFile ~/.ssh/id_ed25519_github

# * GitHub Personal SSH Key
Host github-personal
  HostName github.com
  AddKeysToAgent yes
  UseKeychain yes
  User git
  IdentityFile ~/.ssh/gh_mervinhemaraju_ed25519
Run Code Online (Sandbox Code Playgroud)

两个密钥都是单独创建的并附加到各自的帐户。

奇怪的问题是我使用它大约一个月了,而且它有效。今天,当我登录时,我在我的个人存储库上提交了一些工作,当我尝试进行远程推送(之前适用于此存储库)时,我得到了用户权限被拒绝。

然后我对两个 ssh 键进行了 ssh 测试,结果如下:

ssh -T ssh -T git@github-personal

Hi mervin-hemaraju-enterprise! You've successfully authenticated, but GitHub does not provide shell access.

ssh -T git@github-enterprise

Hi mervin-hemaraju-cko! You've successfully authenticated, but GitHub does not …
Run Code Online (Sandbox Code Playgroud)

ssh github ssh-keys

1
推荐指数
1
解决办法
931
查看次数

是否有可能让Perl运行shell脚本别名?

是否可以让Perl脚本运行shell别名?我遇到的情况是我们有一个我无法修改的Perl模块,它所做的一件事就是通过SSH登录到多个服务器以远程运行一些命令.遗憾的是,有些系统(我也无权修改)有一个错误的SSH服务器,一旦我的系统尝试发送SSH公钥就会断开连接.我有SSH代理运行,因为我需要它连接到其他一些服务器.

我的初始解决方案是设置别名以将ssh设置为ssh -o PubkeyAuthentication = no,但Perl运行它在PATH中找到的ssh二进制文件而不是尝试使用别名.

当我连接到问题服务器或覆盖执行实际连接的Perl模块时,看起来唯一的解决方案是禁用SSH代理.

ssh bash perl ssh-keys

0
推荐指数
1
解决办法
1284
查看次数

设置github时SSH密钥设置问题

我按照教程在github上生成SSH密钥:在上面链接教程的第5步,在我输入后我ssh -T git@github.com应该看到这个:

The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?
Run Code Online (Sandbox Code Playgroud)

但是,我看到了这个:

Agent admitted failure to sign using the key.
Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)

然后,当我尝试使用文件将文件推送到存储库时git push -u origin master,我得到了这个:

Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)

我认为问题在于设置SSH密钥.我怎样才能解决这个问题?

我正在使用Linux.

git version-control github ssh-keys permission-denied

0
推荐指数
1
解决办法
366
查看次数

如何配置命令行git以使用ssh密钥

当我git pull通过命令行执行操作时,它总是要求我的github用户名和密码.我想告诉它在github中使用ssh密钥,再也不用担心了.你怎么做到这一点?

git authentication command-line github ssh-keys

0
推荐指数
2
解决办法
2600
查看次数

Openssh Connection不能与AuthorizedKeysCommand一起使用

我在sshd_config上添加了这些行

AuthorizedKeysCommand /authorizedkeys/authorized-keys
AuthorizedKeysCommandUser ssh-keys

-rwxr-x--- 1 root ssh-keys 712 Dec 23 22:36 /authorizedkeys/authorized-keys 
-rwxr-x---  1 root ssh-keys  712 Dec 23 22:36 authorized-keys
Run Code Online (Sandbox Code Playgroud)

ssh-keys用户可以执行该文件(/ authorizedkeys/authorized-keys).但我不能ssh到服务器; ssh git@myserver.com

在auth.log中我可以看到这一行,

error: Unsafe AuthorizedKeysCommand: bad ownership or modes for directory /
Run Code Online (Sandbox Code Playgroud)

如果我给/ authorizedkeys/authorized-keys文件授予770权限,我会收到以下错误,

error: Unsafe AuthorizedKeysCommand: bad ownership or modes for file /authorizedkeys/authorized-keys
Run Code Online (Sandbox Code Playgroud)

我尝试使用root作为AuthorizedKeysCommandUser并更改/ authorizedkeys/authorized-keys文件的权限和所有者.它也没用.

我在ubuntu 14.04上使用OpenSSH_6.6.1p1.

注意:我可以使用authorized_keys文件ssh

ssh openssh ssh-keys

0
推荐指数
1
解决办法
5022
查看次数

您应该在哪个目录或文件路径中运行eval ssh-agent?

我正在我的PC(ubuntu)上构建一些git用户来练习Github上的工作流程,并使用这个网站来构建用户.我是第3部分,只是输入eval '$(ssh-agent)'但是回来了

bash: SSH_AUTH_SOCK=/tmp/ssh-FxjmM29tR2ak/agent.3856;: No such file or directory
Run Code Online (Sandbox Code Playgroud)

"有办法解决这个问题吗?

git ubuntu github ssh-keys ssh-agent

0
推荐指数
1
解决办法
455
查看次数