是否可以忽略"你的.ssh访问服务器?

时间:2014-06-17 14:26:13

标签: macos ssh terminal ssh-keys

我已经开始在某个地方工作了。我使用从我的计算机生成的公钥可以访问服务器。但是,虽然ssh登录一开始似乎很好,但我实际上无法使用此rsync获取repo。它想要一个我不需要的密码。我通过电子邮件发送了以前的dev,并建议我的终端忽略ssh?这甚至可能吗?我该如何解决这个问题?

需要访问此代码:/

感谢您的帮助!

Last login: Fri Jun 13 11:51:30 on ttys000
Naomis-MacBook-Air:summerspirit.github.io Naomi$ cd
Naomis-MacBook-Air:~ Naomi$ ssh naomi@svn.civicrm.ca
Last login: Fri Jun 13 09:56:56 2014 from 76-10-147-186.dsl.teksavvy.com

[naomi@emily ~]$ ls
community.socialinnovation.ca socialinnovation.ca
[naomi@emily ~]$ ls -alt
total 28
-rw-------. 1 naomi naomi 183 Jun 13 12:43 .bash_history
drwx------. 3 naomi naomi 4096 Jun 13 10:03 .
lrwxrwxrwx. 1 naomi naomi 35 Jun 13 10:03 socialinnovation.ca -> /var/www/vhosts/socialinnovation.ca
lrwxrwxrwx. 1 naomi naomi 45 Jun 13 10:02 community.socialinnovation.ca -> /var/www/vhosts/community.socialinnovation.ca
drwx------. 2 naomi naomi 4096 Jun 13 09:56 .ssh
drwxr-xr-x. 15 root root 4096 Jun 13 09:12 ..
-rw-r--r--. 1 naomi naomi 18 Jul 18 2013 .bash_logout
-rw-r--r--. 1 naomi naomi 176 Jul 18 2013 .bash_profile
-rw-r--r--. 1 naomi naomi 124 Jul 18 2013 .bashrc
[naomi@emily ~]$ mkdir yolo
[naomi@emily ~]$ cd yolo
[naomi@emily yolo]$ rsync -avz naomi@svn.civicrm.ca:/var/www/vhosts/socialinnovation.ca .
The authenticity of host 'svn.civicrm.ca (209.15.213.70)' can't be established.
RSA key fingerprint is 63:99:92:28:c3:dd:b8:eb:c0:ec:c5:3a:11:7a:0f:88.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'svn.civicrm.ca,209.15.213.70' (RSA) to the list of known hosts.
naomi@svn.civicrm.ca's password:
Permission denied, please try again.
naomi@svn.civicrm.ca's password:
Connection closed by UNKNOWN
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: unexplained error (code 255) at io.c(600) [receiver=3.0.6]
[naomi@emily yolo]$
[naomi@emily yolo]$ rsync -avz naomi@svn.civicrm.ca:/var/www/vhosts/socialinnovation.ca .
naomi@svn.civicrm.ca's password:
Permission denied, please try again.
naomi@svn.civicrm.ca's password:
Permission denied, please try again.
naomi@svn.civicrm.ca's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: unexplained error (code 255) at io.c(600) [receiver=3.0.6]
[naomi@emily yolo]$
[naomi@emily yolo]$ rsync -avz naomi@svn.civicrm.ca:/var/www/vhosts/community.socialinnovation.ca .
naomi@svn.civicrm.ca's password:
Permission denied, please try again.
naomi@svn.civicrm.ca's password:
Permission denied, please try again.
naomi@svn.civicrm.ca's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: unexplained error (code 255) at io.c(600) [receiver=3.0.6]
[naomi@emily yolo]$

来自开发3:00 PM(19小时前)

对我来说,我认为你的mac在某种程度上被配置为在连接时忽略你的.ssh键。

令人困惑,但让我想起为什么我不想尝试运行公共服务器......

1 个答案:

答案 0 :(得分:0)

看起来你正在从Naomis-MacBook-Air转到svn.civicrm.ca(又名emily),然后你又尝试ssh(通过rsync)到{{1}从那里。

三种可能的解决方案:

<强> 1。没有网络的rsync

因为您正尝试rsync naomi@svn.civicrm.ca:/var/www/vhosts/socialinnovation.ca 来自 svn.civicrm.ca,您可以使用:

svn.civicrm.ca

根本不需要在网络上使用ssh。

<强> 2。确保您转发代理

您的rsync -avz /var/www/vhosts/socialinnovation.ca . .ssh被忽略的原因是您未允许ssh转发您的座席。您可以通过运行:

来解决此问题
Naomis-MacBook-Air

echo "ForwardAgent yes" > ~/.ssh/config 上。这应该允许您在ssh'da到远程服务器上后继续在Naomis-MacBook-Air上使用ssh和rsync。

您可以通过反复运行emily来测试它是否有效 - 它绝不会要求您输入密码!

第3。将.ssh / id_rsa.pub和.ssh / id_rsa复制到远程服务器并在那里使用

这是您在原始问题的评论中尝试使用ssh localhost尝试的内容。

在远程服务器上获得pbcopy/home/naomi/.ssh/id_rsa后,如果您有两个文件/home/naomi/.ssh/id_rsa.pub,那么您应该可以:

chmod 400

您必须执行手动naomi@emily:~$ ssh-agent bash naomi@emily:~$ ssh-add naomi@emily:~$ rsync ... ssh-agent命令,因为您还没有可以使用的代理程序。 MacBook Air上的情况并非如此,因为MacOS X会在后台运行代理。

但是我建议不要使用此选项,因为这意味着将您的私钥放在远程服务器上,然后该服务器上具有root访问权限的任何人都可以访问。