解决sshing到我自己的电脑


2

我有经验通过ubuntu ssh到几台电脑。但是由于某些原因,我无法从同一网络中的同一台机器上ssh到我自己的计算机(这个特定的计算机)。我也可以将其他计算机也自己,但不是特别是这个。

我的主机名(出于安全原因不同)

lab.dept.uni.ece

我的帐号是

user

做一个简单的:

ssh user@lab.dept.uni.ece

应该让我ssh到我自己的计算机,但当我输入我的用户名和密码,它说“权限被拒绝”,好像我的密码(或可能的用户名?)是错误的。它没有抱怨主机名或用户名,所以我假设他们是对的。有没有办法检查?另一方面,我可能在计算机上设置了一些sshing块?

另外,我记得在我的实验室里有一个博士后还告诉我,我的计算机上发生了一些有趣的事情,因为当他想要ssh到他的帐户时(我们在我的计算机上为他创建了一个,看看他是否可以使用它与他的用户/密码),他实际上不能。

ssh已安装。我该怎么办呢?

输出ssh -vv user@lab.dept.uni.edu

OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to lab.dept.uni.edu [128.111.113.132] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type -1
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.4
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 86:b8:8e:c5:a5:53:5a:df:26:99:0b:90:9f:4b:91:8e
debug1: Host 'lab.dept.uni.edu' is known and matches the ECDSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:9
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/user/.ssh/id_rsa ((nil))
debug2: key: /home/user/.ssh/id_dsa ((nil))
debug2: key: /home/user/.ssh/id_ecdsa ((nil))
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/user/.ssh/id_rsa
debug1: Trying private key: /home/user/.ssh/id_dsa
debug1: Trying private key: /home/user/.ssh/id_ecdsa
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
user@lab.dept.uni.edu's password: 
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.

我还认为用户名可能是个问题,因为我有一个用户名:'user'和'User',其中一个是小写,另一个是大写。然而,它似乎不是问题,因为我不能ssh到我刚刚创建的我知道密码的'bob'这样的新用户名。


请再试一次 ssh -vv user@lab.dept.uni.ece 并将输出添加到您的问题。还有,请 编辑 并澄清您是否尝试从同一台机器,同一网络或网络外部的另一台机器上进行ssh。最后,您确定用户实际存在于系统中吗?你在用某种东西吗? LDAP ?最后,还要说明是否提示您输入密码或是否使用私钥。
terdon

更新。我被提示输入密码并说它失败了。我不认为我正在使用某种LDAP,我不认为是这种情况。它也可能是防火墙问题?我创建了另一个用户并试图ssh并且失败了。
Arturo

好的,看起来你的密码错了。你有没有和你的IT部门谈过话?也许你正在连接到网关服务器而你没有帐户。或者,您的服务器已禁用密码连接并需要私钥。我不是ssh的专家,但我怀疑这是我们可以从这里调试的东西。你真的应该和你的IT人员交谈。
terdon

我和他们交谈过,他们也无法弄明白。你认为重新安装ssh会起作用吗?
Arturo

1
嗯。不,这不应该有太大的区别。我想,清除它可能。您可以尝试删除所有配置文件并重新安装。你也可以试试 ssh -vvv 获得更加详细的输出,以防万一。我强调说我不是专家,所以请耐心等待。如果你在一段时间后没有得到答案,你可以尝试标记问题并要求mods将其迁移到 Unix& Linux的 你会发现更多的铁杆* nix极客。几天后给我打电话,我也可以提供赏金(无论是在这里还是在这里 Unix& Linux的 ),我也很好奇。
terdon

Answers:


2

您从客户端的有利位置看到了这一点,但由于您是要尝试登录的PC的所有者,因此您可以通过启动 SSH 带有调试选项的守护进程:

  service ssh stop
  /usr/sbin/sshd -Dd 

d 防止守护进程分离, d 将其置于调试模式)。现在您可以尝试从其他PC上登录,并查看守护程序的输出以及拒绝您访问的原因。

你应该记住上的错误信息 客户端 并不意味着提供非常丰富的信息,因为除了合法的调试目的,它们可能被恶意攻击者用来提高他们进入毫无防备的受害者计算机的机会。另一方面,守护程序本身的调试消息只能由pc的所有者访问,因此它们将用于合法用途。这就是服务器端消息提供更多信息的原因。

希望这会给你/我们足够的信息来在下一次迭代中调试问题。


最后,技术支持设法解决了我的问题。显然问题是我没有在允许ssh到该计算机的用户的特定ssh文件中添加权限。
Arturo
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.