通过 Putty (pscp) 以 root 身份登录时出现问题

通过 Putty (pscp) 以 root 身份登录时出现问题

我正在研究一些可破解的虚拟机。在一个练习中,我必须将下载到 Linux 计算机上的文件传输到 Windows 计算机。

我尝试通过 root 使用 pscp 传输文件,但即使我输入了正确的密码,我仍然收到访问被拒绝的消息。我将sshd_config文件修改为PermitRootLogin,将PasswordAuthentication设置为yes,然后重新启动ssh服务,但仍然收到访问被拒绝的消息。

然后,我将文件复制到我的linux机器上的非root用户的主目录中,并使用pscp通过非root用户将文件传输到windows,效果很好。

为了允许通过 root 进行传输,除了我提到的内容之外,我还应该在 sshd_config 文件中检查其他内容吗?为了能够通过 root 传输文件,我还应该考虑其他什么吗?

这不是什么大问题,因为我最终能够传输文件。但是,我只是想知道为什么它不能通过 root 运行。

答案1

看一眼sshd_config 手册页,允许根用户登录部分:

     PermitRootLogin
         Specifies whether root can log in using ssh(1).  The argument
         must be yes, prohibit-password, without-password,
         forced-commands-only, or no.  The default is yes.

         If this option is set to prohibit-password or without-password,
         password and keyboard-interactive authentication are disabled for
         root.

         If this option is set to forced-commands-only, root login with
         public key authentication will be allowed, but only if the
         command option has been specified (which may be useful for taking
         remote backups even if root login is normally not allowed).  All
         other authentication methods are disabled for root.

         If this option is set to no, root is not allowed to log in.

可能你的文件设置为。尝试将其更改为是的,重新启动ssh服务并重试。

相关内容