SSh - 使用不同的用户名连接

时间:2015-03-23 20:24:35

标签: ssh

我正试图通过我的mac连接到我的大学服务器。有问题的服务器如下:

  • silo.soic.indiana.eduodic.cs.indiana.edu

当我尝试使用我的用户名时,我在连接服务器和访问我的文件方面没有任何问题。但是,我正在尝试使用我的朋友用户名(和密码,由他提供),我似乎无法连接到任何一个实例。我搜索了这些问题,但我没有解决方案。

当我连接到服务器时,我使用ssh odin.cs.indiana.edu,它会自动检测我的用户名并提示我输入密码。输入密码后,我连接到所述实例。

对于我的朋友用户名,我使用ssh friend@odin.cs.indiana.edu之后会提示我输入密码。当我输入密码时,我得到返回Permission denied, please try again.。我使用了详细的-v参数来获取有关该过程的更多信息,我得到了这个:

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to odin.cs.indiana.edu [129.79.240.100] port 22.
debug1: Connection established.
debug1: identity file /Users/isharief/.ssh/id_rsa type 1
debug1: identity file /Users/isharief/.ssh/id_rsa-cert type -1
debug1: identity file /Users/isharief/.ssh/id_dsa type -1
debug1: identity file /Users/isharief/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_4*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 55:49:2c:08:67:a9:f4:33:99:b1:3b:90:c5:c0:33:32
debug1: Host 'odin.cs.indiana.edu' is known and matches the RSA host key.
debug1: Found key in /Users/isharief/.ssh/known_hosts:7
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/isharief/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/isharief/.ssh/id_dsa
debug1: Next authentication method: password

在我输入密码后,我被拒绝了。我们俩在sshkeys等方面的技能极低,所以有人可以就这个问题给出一个简单的解释/解决方法吗?

1 个答案:

答案 0 :(得分:0)

您可以按照自己的身份登录,因为在远程服务器的/home/you/.ssh/authorized_keys中,您的公钥存在但在/home/yourfriend/.ssh/authorized_keys中不存在。您需要将公钥添加到/home/yourfriend/.ssh/authorized_keys。您可以尝试以下

ssh-copy-id -i yourkey.pub yourfriend@servername

它将公钥添加到/home/yourfriend/.ssh/authorized_keys。但是你需要你朋友的密码才能登录服务器。如果它不起作用,您需要手动将密钥附加到/home/yourfriend/.ssh/authorized_keys。如果您手动追加,请确保将该密钥作为一行附加。

希望它有所帮助。它可能会解决此问题,但由于远程服务器上的sshd_config文件,您仍然可能遇到问题。尝试上述方法,如果您仍然遇到任何问题,请告诉我。