cygwin 和 debian wheezy 之间的 ssh

cygwin 和 debian wheezy 之间的 ssh

我正在尝试连接桌面(win7 x64)和笔记(debian wheezy x32)。已完成 ssh cygwin 和 debian 的标准安装。创建公钥并通过 usbflash 将其移动到~/.ssh/authorizwd_keys~/.ssh/

在 cygwin 中制作

cd ~/.ssh
chmod 700 id_rsa

然后尝试连接并记录

debug1: ssh_ecdsa_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,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/A/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /home/A/.ssh/id_dsa
debug1: Trying private key: /home/A/.ssh/id_ecdsa
debug1: Trying private key: /home/A/.ssh/id_ed25519
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password

UPD 检查文件权限,将日志级别更改为 DEBUG。然后我尝试连接,但日志中没有写入任何内容,只有关于重新加载服务的信息

May 17 09:48:44 a sshd[4337]: Received SIGHUP; restarting.
May 17 09:48:44 a sshd[4386]: Set /proc/self/oom_score_adj from -1000 to -1000
May 17 09:48:44 a sshd[4386]: debug1: Bind to port 22 on 0.0.0.0.
May 17 09:48:44 a sshd[4386]: Server listening on 0.0.0.0 port 22.
May 17 09:49:43 a sshd[4386]: Received SIGHUP; restarting.
May 17 09:49:43 a sshd[4417]: Set /proc/self/oom_score_adj from -1000 to -1000
May 17 09:49:43 a sshd[4417]: debug1: Bind to port 22 on 0.0.0.0.
May 17 09:49:43 a sshd[4417]: Server listening on 0.0.0.0 port 22.
May 17 09:49:43 a sshd[4417]: debug1: Bind to port 22 on ::.
May 17 09:49:43 a sshd[4417]: Server listening on :: port 22.
May 17 09:58:23 a sshd[4417]: Received SIGHUP; restarting.
May 17 09:58:23 a sshd[4491]: Server listening on 0.0.0.0 port 22.
May 17 09:58:23 a sshd[4491]: Server listening on :: port 22.

UPD 尝试在 cygwin 中使用命令“ssh -vvv”进行连接,结果出现错误

"debug3 Incorrect RSA1 identifer" 
"debug3 Couldnt load "/home/A/.ssh/id_rsa" as RSA publick key"

答案1

客户端不会显示诸如“使用方法‘publickey’和某某密钥进行身份验证失败”之类的消息,因此,为了正确地调试此问题,请在您的 Debian 服务器上按照以下清单进行操作:

  1. 确保~/.ssh用户目录的权限不要太宽松。

    user:user它通常应该由(user服务器上用户的名称在哪里)拥有并0700在其上设置权限位。

  2. 确保~/.ssh/authorized_keys文件是user:user0600

  3. 编辑/etc/ssh/sshd_config(注意字母“d”——您需要服务器的配置文件)并提高其日志记录级别:

    LogLevel DEBUG
    

    保存文件并重新加载服务器的配置:

    # service ssh reload
    
  4. 现在执行另一次登录尝试并检查sshd写入的内容/var/log/auth.log

  5. 将设置恢复LogLevel为其标准值,INFO然后再次重新加载配置。

相关内容