将SSH密钥添加到远程服务器 [英] Adding SSH Keys to remote servers

查看:1193
本文介绍了将SSH密钥添加到远程服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道人们会提出什么建议作为向远程服务器添加部署密钥的好方法,以便它可以检出私有git repo。



我一直在试图用Capistrano部署一个应用程序,但在尝试检出应用程序链接到的存储库时,我一直相信SSH密钥失败。



我已经尝试了代理转发,但我想我可能更好,只需向每个远程服务器添加部署密钥,然后将此密钥添加到存储库即可。



这样做?我正在寻找几个简单的命令来运行每个远程服务器。

解决方案

我想哟想复制用户'public key to the server and then add'em to the ssh,right?



为此,您需要执行以下操作:

将密钥复制到服务器



从我的机器复制到远程机器:

  scp key_name.pub git @ serverIP:key_name.pub 

然后将它加载到authorized_keys文件中

  cat key_name.pub>> .ssh / authorized_keys 


I would like to know what people would suggest as a good way to add a deployment key to a remote server, so that it may checkout a private git repo.

I've been trying to deploy an application with Capistrano but keep getting failures with the SSH keys I believe when attempting to checkout the repository the application is linked to.

I have tried Agent Forwarding but I think I might be better just adding a deployment key to each remote server and then adding this key to the repository.

How best would I go about doing this? I'm looking for a few simple commands to run off against each remote server.

解决方案

I think yo want to copy the users' public keys to the server and then add'em to the ssh, right?

To do that you need to do the following:

Copy keys to server

copy from my machine to a remote machine:

scp key_name.pub git@serverIP:key_name.pub

Then cat it to the authorized_keys file

cat key_name.pub >> .ssh/authorized_keys

这篇关于将SSH密钥添加到远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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