简体   繁体   English

如何在 Linux 中创建与 ZE1ADBCBB92C622D0B3E619F9D0730 一起使用的 Jenkins SSH 密钥?

[英]How to create Jenkins SSH key in Linux for use with Github?

At the moment, I'm trying to configure an SSH key to use for cloning Github repositories into a Jenkins pipeline.目前,我正在尝试配置一个 SSH 密钥,用于将 Github 存储库克隆到 Jenkins 管道中。 When I login to my Linux server as the Jenkins user and attempt to create a SSH keypair, below is the output I get:当我以 Jenkins 用户身份登录到我的 Linux 服务器并尝试创建 SSH ICEDB 密钥对时,下面是 Z78E6221F6398FDCE34

-bash-4.2$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/jenkins/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Saving key "/var/lib/jenkins/.ssh/id_rsa" failed: Permission denied

Do I need to elevate my privileges in order to create these keys?我是否需要提升我的权限才能创建这些密钥? Thanks.谢谢。

Figured it out.弄清楚了。 When running the ssh-keygen command, it likes to create the.ssh directory on its own.在运行 ssh-keygen 命令时,它喜欢自己创建 .ssh 目录。 I had created it ahead of time and that clearly created some sort of permissions issue.我提前创建了它,这显然造成了某种权限问题。

So in the future: if you're ever creating these keys and getting a permissions error, allow the command to create the.ssh directory to avoid any issues.所以在未来:如果您曾经创建这些密钥并遇到权限错误,请允许该命令创建 .ssh 目录以避免任何问题。 Thanks.谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM