0

I have really an SFTP server with both an authentication key and a 'normal' password. I can access with my credentials via WinSCP without any problems. Unfortunately, with phpseclib there seems no way to do the same.

Is there a possibility to use both in phpseclib, a key and a password. Or is there any other way in PHP to connect a SFTP server with these settings? And no, I don't speak of an authentication key with passphrase ;-)

Hey Martin Prikryl your WinSCP is great and in my case it works fine with bot akey and a passord. But please, read my question carefully. I want to do the same with PHP and have some problem there. And no posting in StackOverflow got a solution. The 5 answers your mentioned, unfortunately, don't provide a solution :-(

Update: See also the discussion here: https://github.com/phpseclib/phpseclib/issues/1109

Klemens
  • 11
  • 1
  • Sorry, but this is stupid :-( All 5 answers are related to a passphrase for a key or to use only a password :-( A few people want to tell me what are my sftp settings are, but I know the settings I tried it with WinSCP and it works with both a key and a 'normal' password. So,I have not been looking for any solution to have any problem. – Klemens Mar 31 '17 at 07:52
  • 1
    I do not understand. The first [answer by @user2048615](http://stackoverflow.com/a/14739818/850848) is about password and private key, isn't it? And if you believe it is not, why did you accept the duplicate? – Martin Prikryl Mar 31 '17 at 10:28
  • At the time the question marked as a duplicate was made phpseclib didn't support multi factor authentication. It now does. More info: http://phpseclib.sourceforge.net/ssh/auth.html#multifactor I updated my orig answer in the duplicate question. – neubert Mar 31 '17 at 16:49
  • @neubert I do not understand you either. This question was marked duplicate today. - Also [your updated answer](http://stackoverflow.com/a/13809423/850848) does not show public key authentication. But the [answer by @BoukeVersteegh](http://stackoverflow.com/a/40765213/850848) does. – Martin Prikryl Mar 31 '17 at 18:53
  • 1
    @MartinPrikryl - It looks like you're right. I copy / pasted the code from phpseclib.sourceforge.net. I've updated what I posted on stackoverflow.com to use password and public key auth. I think the original example was supposed to be password and keyboard-interactive auth since it's very similar to http://phpseclib.sourceforge.net/ssh/auth.html#keyboard, but I think public key and password auth is a more relevant example. – neubert Mar 31 '17 at 19:09
  • @MartinPrikryl, Yes, it is about password and private key. And yes, there a some other questions in this direction. However the answer was always, that can be the case. So, the answers wasn'nt really related to the question ;-) BTW, I didn't accept the question as duplicate, it was just a click and there is no way reverse it. – Klemens Apr 03 '17 at 08:55
  • @Klemens Sorry, I do not understand. So does the answer by BoukeVersteegh and edited answer by neubert answer your question or not - What do you mean by *"However the answer was always, that can be the case"*? – Martin Prikryl Apr 03 '17 at 09:02
  • @MartinPrikryl Sorry, the sentence is stupid, forget it ;-) I meant the answers wasn't related to the question. People answered all in in the way that there is either a password or a rsa key protection. However, in my case there is really both. I think the best way to understand the problem is to read this posting: https://github.com/phpseclib/phpseclib/issues/1109 – Klemens Apr 03 '17 at 13:00
  • Both answers by BoukeVersteegh and neubert show how to use multifactor authentication using **both password and private key**. What makes you keep believing that they do not? Actually they use the very same code as can be seen in the link you have posted. And it works. I've tested it. – Martin Prikryl Apr 03 '17 at 14:09
  • @ Martin Prikryl, have you tried out the solutions by BoukeVersteegh and neubert? I did, unfortunately the 'solution' by BoukeVersteegh doesn't work at all. And the solution by neubert doesn't refer to the SFTP class, but to the SSH2 class of phpseclib. Indeed, to get access with SSH2 is possible, but only the key has no passphrase :-( – Klemens Apr 04 '17 at 09:32

0 Answers0