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

SSh-使用不同的用户名连接,ssh,Ssh,我正在尝试通过mac连接到我的大学服务器。所涉及的服务器如下: silo.soic.indiana.edu和odic.cs.indiana.edu 当我尝试使用我的用户名时,我在连接到服务器和访问我的文件方面没有问题。然而,我试图使用我的朋友的用户名(和密码,由他提供),我似乎无法连接到任何一个实例。我在谷歌上搜索了这些问题,但没有解决方案 当我连接到服务器时,我使用ssh-odin.cs.indiana.edu,它会自动检测我的用户名并提示我密码。输入密码后,我将连接到上述实例 对于我的朋

我正在尝试通过mac连接到我的大学服务器。所涉及的服务器如下:

  • silo.soic.indiana.edu
    odic.cs.indiana.edu
当我尝试使用我的用户名时,我在连接到服务器和访问我的文件方面没有问题。然而,我试图使用我的朋友的用户名(和密码,由他提供),我似乎无法连接到任何一个实例。我在谷歌上搜索了这些问题,但没有解决方案

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

对于我的朋友用户名,我使用
sshfriend@odin.cs.indiana.edu
之后,它会提示我输入密码。当我输入密码时,返回的
权限被拒绝,请重试。
。我使用verbose
-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
OpenSSH_6.2p2,OSSLShim 0.9.8r 2011年12月8日
debug1:读取配置数据/etc/ssh\u config
debug1:/etc/ssh\u配置第20行:应用*
debug1:连接到odin.cs.indiana.edu[129.79.240.100]端口22。
debug1:已建立连接。
debug1:identity file/Users/isharief/.ssh/id\u rsa类型1
debug1:identity file/Users/isharief/.ssh/id\u rsa-cert类型-1
debug1:identity file/Users/isharief/.ssh/id_dsa type-1
debug1:identity file/Users/isharief/.ssh/id_dsa-cert type-1
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_6.2
debug1:远程协议版本2.0,远程软件版本OpenSSH_4.3
debug1:匹配:OpenSSH_4.3 pat OpenSSH_4*
debug1:SSH2\u MSG\u KEXINIT已发送
debug1:SSH2\u MSG\u KEXINIT已收到
debug1:kex:server->client aes128 ctr hmac-md5无
debug1:kex:客户端->服务器aes128 ctr hmac-md5无

debug1:SSH2_MSG_KEX_DH_GEX_请求(1024您可以以您的身份登录,因为在远程服务器的/home/You/.ssh/authorized_密钥中存在您的公钥,但它不在/home/yourfriend/.ssh/authorized_密钥中。您需要将公钥添加到/home/yourfriend/.ssh/authorized_密钥中。您可以尝试以下操作

ssh-copy-id -i yourkey.pub yourfriend@servername
它会将公钥添加到/home/yourfriend/.ssh/authorized_密钥中。但您需要您的朋友用于登录服务器的密码。如果不起作用,则需要手动将密钥附加到/home/yourfriend/.ssh/authorized_密钥中。如果手动附加,请确保将密钥作为一行附加


希望它有帮助。它可能会解决问题,但由于远程服务器上的sshd_config文件,您仍然可以面对问题。尝试上述方法,并让我知道您是否仍然面临任何问题。

一个可能的解决方法可能是执行
su friend
,将用户名切换为您朋友的用户名…如果他们非常友好或愚蠢的话然后把他们的密码发给他的主目录。