<tfoot id='4yfMB'></tfoot>

      1. <i id='4yfMB'><tr id='4yfMB'><dt id='4yfMB'><q id='4yfMB'><span id='4yfMB'><b id='4yfMB'><form id='4yfMB'><ins id='4yfMB'></ins><ul id='4yfMB'></ul><sub id='4yfMB'></sub></form><legend id='4yfMB'></legend><bdo id='4yfMB'><pre id='4yfMB'><center id='4yfMB'></center></pre></bdo></b><th id='4yfMB'></th></span></q></dt></tr></i><div id='4yfMB'><tfoot id='4yfMB'></tfoot><dl id='4yfMB'><fieldset id='4yfMB'></fieldset></dl></div>

        <small id='4yfMB'></small><noframes id='4yfMB'>

          <bdo id='4yfMB'></bdo><ul id='4yfMB'></ul>

        <legend id='4yfMB'><style id='4yfMB'><dir id='4yfMB'><q id='4yfMB'></q></dir></style></legend>

      2. phpseclib - 我可以使用用户名、密钥和密码进行连

        时间:2023-05-21

        <i id='T5UgU'><tr id='T5UgU'><dt id='T5UgU'><q id='T5UgU'><span id='T5UgU'><b id='T5UgU'><form id='T5UgU'><ins id='T5UgU'></ins><ul id='T5UgU'></ul><sub id='T5UgU'></sub></form><legend id='T5UgU'></legend><bdo id='T5UgU'><pre id='T5UgU'><center id='T5UgU'></center></pre></bdo></b><th id='T5UgU'></th></span></q></dt></tr></i><div id='T5UgU'><tfoot id='T5UgU'></tfoot><dl id='T5UgU'><fieldset id='T5UgU'></fieldset></dl></div>

        <legend id='T5UgU'><style id='T5UgU'><dir id='T5UgU'><q id='T5UgU'></q></dir></style></legend>
            1. <small id='T5UgU'></small><noframes id='T5UgU'>

                <tfoot id='T5UgU'></tfoot>

                  <tbody id='T5UgU'></tbody>

                  <bdo id='T5UgU'></bdo><ul id='T5UgU'></ul>
                • 本文介绍了phpseclib - 我可以使用用户名、密钥和密码进行连接吗(不是密钥密码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  抱歉,如果我在文档中遗漏了这一点,但是否可以使用私钥和密码(不是我的私钥的密码)连接到 SFTP 服务器.

                  Apologies if I have missed this in the documentation but is it possible to connect to an SFTP server with a private key and a password (not a passphrase for my private key).

                  示例显示了用户名/密码、用户名/密钥和用户名/密钥/密钥密码验证类型.

                  The examples show username/password, username/key and username/key/key passphrase authentication types.

                  通过命令行连接时,我会收到输入密码的提示...

                  When connecting via the command line I would get this prompt for my password...

                  user@x.x.x.x 的密码:

                  user@x.x.x.x's password:

                  希望这个库可以处理这个问题吗?

                  Hopefully this library can handle this?

                  否则,是否还有其他基于 PHP 的解决方案可能支持用户名/密钥和服务器密码身份验证?我在这里很灵活,如果需要可以安装模块.

                  Otherwise are there any other PHP based solutions that might support username/key and server password authentication? I'm quite flexible here and can install modules if need be.

                  编辑

                  感谢到目前为止的帮助...我已经尝试过你提到的 Neubert ,但这似乎不起作用.为了验证连接到服务器需要什么,我在命令行上测试了这个.
                  sftp key user@ip - 按预期提示输入密码
                  sftp user@ip - 提示输入密码,但输入正确后告诉我已通过身份验证并部分成功".

                  Thanks for the help so far... I had tried what you mentioned Neubert but this didn't seem to work. And to verify what is necessary to connect to the server I tested this on the command line.
                  sftp key user@ip - Prompted for password as expected
                  sftp user@ip - Prompted for password but when entered correctly told I am "authenticated with partial success".

                  如果我可以使用密钥和密码进入,我认为对目录和密钥的权限应该没问题.

                  I think the permission on directories and keys should be fine if I can get in using key and then password.

                  我开始认为这个库不支持我需要的东西.

                  I am starting to think this library doesn't support what I need.

                  推荐答案

                  phpseclib 支持多因素认证.以下是如何操作的示例:

                  phpseclib supports multi factor authentication. Here's an example of how to do it:

                  <?php
                  include('Net/SSH2.php');
                  include('Crypt/RSA.php')
                  
                  $rsa = new Crypt_RSA();
                  $rsa->loadKey(file_get_contents('/path/to/key.pem'));
                  
                  $ssh = new Net_SSH2('www.domain.tld');
                  if (!$ssh->login('username', 'pass1', $rsa)) {
                      exit('Login failed');
                  }
                  // this does the same thing as the above
                  //if (!$ssh->login($username, 'pass1') && !$ssh->login('username', $rsa)) {
                  //    exit('Login failed');
                  /

                  <legend id='El3Aj'><style id='El3Aj'><dir id='El3Aj'><q id='El3Aj'></q></dir></style></legend>

                  • <tfoot id='El3Aj'></tfoot>

                      <small id='El3Aj'></small><noframes id='El3Aj'>

                        <tbody id='El3Aj'></tbody>
                        <bdo id='El3Aj'></bdo><ul id='El3Aj'></ul>

                          <i id='El3Aj'><tr id='El3Aj'><dt id='El3Aj'><q id='El3Aj'><span id='El3Aj'><b id='El3Aj'><form id='El3Aj'><ins id='El3Aj'></ins><ul id='El3Aj'></ul><sub id='El3Aj'></sub></form><legend id='El3Aj'></legend><bdo id='El3Aj'><pre id='El3Aj'><center id='El3Aj'></center></pre></bdo></b><th id='El3Aj'></th></span></q></dt></tr></i><div id='El3Aj'><tfoot id='El3Aj'></tfoot><dl id='El3Aj'><fieldset id='El3Aj'></fieldset></dl></div>