This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 166555

Summary: sFTP continously prompts for password on upload
Product: php Reporter: sketchman <sketchman>
Component: FTP SupportAssignee: Tomas Mysik <tmysik>
Status: VERIFIED FIXED    
Severity: blocker CC: blaha, fzamboj, ndeboer, pjiricka, sustaining
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: the prompt when I click oin test
Screenshot of password prompt - NetBeans IDE Dev (Build 2009-07-14_17-07-02)

Description sketchman 2009-06-04 14:27:53 UTC
I'm having an issue where my SFTP connection continueously asks for a password when I try to upload files.  My settings
are as follows:

Manage Remote Connections
Type: SFTP
Hostname: Our server
Port: 22
Username: our username
Password: our password
Private Key File: left blank
Known Host File: a blank writeable xml file
Initial Directory: our directory
Timeout (s): 30

When I click on the Test button, it prompts for the password.  If I click OK then it prompts again and again until I
actually enter in the password.  If I click CANCEL then it succeeds with the message 'Connection succeeded.'

After this I click OK on the 'Connect succeeded' dialogue and then OK on the 'Manage Remote Connections' window.  I set
my UPLOAD FILES field to 'ON SAVE' and proceed to using my project.

Everytime I do a save I am prompted for the password similiar to what I described above.  If I click CANCEL, then the
files are uploaded but if I click OK then it continues to prompt for a password until I give it.

I originally had Netbeans 6.5 installed.  I installed 6.7 Beta in a new folder and it started producing this problem.  I
then installed the latest 6.7 RC 1 into another folder and continued to see this problem with RC 1.

I am using the original Project that was created with 6.5.  I had to recreate the Remote Connection, however, for each
new version since it didn't stay.
Comment 1 sketchman 2009-06-04 14:36:24 UTC
Created attachment 83205 [details]
the prompt when I click oin test
Comment 2 Tomas Mysik 2009-06-04 16:02:01 UTC
Unfortunately I cannot reproduce (on Linux, I will try to reproduce on Windows but it should not make any difference IMHO).

The dialog comes from the SFTP library, not NetBeans; would it be possible to get a log with communication with your remote server (right click any
source folder/file and choose upload and then copy&paste lines from the Output window here)? Please check that the log does not contain any sensitive
information.

Anyway, I will have a look at the code and try to find out what could be the reason for such behaviour.

Thanks a lot for cooperation.
Comment 3 sketchman 2009-06-04 16:42:25 UTC
Thanks for the reply.

Here is what the output window shows:

Connecting to [servername] port 22
Connection established
Remote version string: SSH-1.99-OpenSSH_4.2
Local version string: SSH-2.0-JSCH-0.1.41
CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
aes256-ctr is not available.
aes192-ctr is not available.
aes256-cbc is not available.
aes192-cbc is not available.
arcfour256 is not available.
SSH_MSG_KEXINIT sent
SSH_MSG_KEXINIT received
kex: server->client aes128-ctr hmac-md5 none
kex: client->server aes128-ctr hmac-md5 none
SSH_MSG_KEXDH_INIT sent
expecting SSH_MSG_KEXDH_REPLY
ssh_rsa_verify: signature true
Host '[servername]' is known and mathces the RSA host key
SSH_MSG_NEWKEYS sent
SSH_MSG_NEWKEYS received
SSH_MSG_SERVICE_REQUEST sent
SSH_MSG_SERVICE_ACCEPT received
Authentications that can continue: publickey,keyboard-interactive,password
Next authentication method: publickey
Authentications that can continue: keyboard-interactive,password
Next authentication method: keyboard-interactive
Authentications that can continue: password
Next authentication method: password
Authentication succeeded (password).
CWD [root path]
Directory successfully changed.
CWD [root path and folder location]
Directory successfully changed.
STOR [filename]
File receive OK.
QUIT
Goodbye

Summary
====================
Succeeded:
file      [path and filename]
Runtime: 516 ms, transfered: 1 file(s), 28.085 KB
Comment 4 sketchman 2009-06-04 16:44:26 UTC
So it forced to look for keyboard interaction before taking in my saved password.  Here is my build info:

Product Version: NetBeans IDE 6.7 RC1 (Build 200905282243)
Java: 1.6.0_12; Java HotSpot(TM) Client VM 11.2-b01
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 5 Tomas Mysik 2009-06-04 16:52:12 UTC
Yes, you are right; my log is:

Authentications that can continue: publickey,keyboard-interactive,password
Next authentication method: publickey
Authentications that can continue: password
Next authentication method: password
Authentication succeeded (password).

Not sure why the keyboard-interactive was skipped. I will investigate more, thanks for reporting.
Comment 6 sketchman 2009-06-04 18:00:23 UTC
Thanks for looking into this.

P.S. this is very minor, but just noticed that there is a typo in the output that netbeans gave.  It says "Host
'[servername]' is known and mathces the RSA host key"  The word "mathces" is misspelled, should be "matches".   Nothing
big but something to fix.
Comment 7 Tomas Mysik 2009-06-05 09:47:34 UTC
> '[servername]' is known and mathces the RSA host key

This message comes directly from the SFTP library so it won't be fixed on NB side.

Thanks.
Comment 8 ndeboer 2009-06-16 09:47:53 UTC
I have two Linux machines. When uploading to the older one (SuSE 9.3 with openssh 3.9) it has this behaviour, but when
uploading to the newer one (Ubuntu with openssh 4.7) everything works fine.

So, my guess the issues has tot do with the server or its configuration and not with Netbeans.
Comment 9 Tomas Mysik 2009-07-07 13:48:24 UTC
Increasing priority, I will try to fix this issue for the next milestone.
Comment 10 Tomas Mysik 2009-07-14 08:51:51 UTC
Guys, could you please attach a screenshot of the password dialog? It would help a lot. Thanks.
Comment 11 Tomas Mysik 2009-07-14 11:43:14 UTC
I hope that this issue is fixed now. Please verify using PHP build #574 or newer [1]. Thanks.
http://hg.netbeans.org/web-main/rev/5af4c211cd73

[1] http://bertram.netbeans.org/hudson/job/PHP-build/
Comment 12 sketchman 2009-07-14 15:17:35 UTC
Downloaded, and it works great.  It did prompt me the first time although I had already entered in the password, but I
put it in the prompt and clicked okay and it never asked again.  Thanks for the fix!
Comment 13 Tomas Mysik 2009-07-14 17:05:47 UTC
If you already entered the password, it should not ask you twice. Could you please attach a screenshot with a
remote server configuration and tell us when exactly it asks you for your password? That would help us a lot. 

Thanks a lot.
Comment 14 Quality Engineering 2009-07-15 07:18:57 UTC
Integrated into 'main-golden', will be available in build *200907150249* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/5af4c211cd73
User: Tomas Mysik <tmysik@netbeans.org>
Log: #166555: sFTP continously prompts for password on upload
#168223: sFTP Private key problem on Windows 7
Comment 15 Tomas Mysik 2009-07-15 17:03:11 UTC
Waiting for user's input in order to fix this issue completely.

Thank you for your cooperation.
Comment 16 sketchman 2009-07-15 18:05:46 UTC
Created attachment 84797 [details]
Screenshot of password prompt - NetBeans IDE Dev (Build 2009-07-14_17-07-02)
Comment 17 sketchman 2009-07-15 18:07:45 UTC
Attached above is the screen shot.  This is the version info for my client:

Product Version: NetBeans IDE Dev (Build 2009-07-14_17-07-02 )
Java: 1.6.0_12; Java HotSpot(TM) Client VM 11.2-b01
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 18 Tomas Mysik 2009-07-16 10:32:13 UTC
Aha, now I see. I tried to fix this - could you please verify that it works for you? Please use PHP build #587 [1] or newer. It would really help us if you could
verify different scenarios (no password, password etc.). Thanks a lot for your cooperation!
http://hg.netbeans.org/web-main/rev/6ea7c62a3484

[1] http://bertram.netbeans.org/hudson/job/PHP-build/
Comment 19 Filip Zamboj 2009-07-16 19:32:57 UTC
finally I forced server to produce kinda similar log as reported :) However, frankly, it took me some time to figure
that authentication order out :). Thank you guys from ILM!;) 

this is the log it produced. Btw, the order of authentications here doesn't have to correspond with reality.

debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Authentications that can continue: publickey,password,keyboard-interactive
THIS JUMP HERE IS BECAUSE IT DIDN'T MATCH WITH ANY KEY I HAVE
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive

settings: 

Type: SFTP
Hostname: Our server
Port: 22
Username: our username
Password: our password
Private Key File: left blank
Known Host File: a blank writeable xml file
Initial Directory: our directory
Timeout (s): 30


1. public-key, keyboard-interactive, password in this order; public-key is not provided 
results: 
a. test remote connection settings: WORKS 
b. upload on save: WORKS 
c. manual upload: Well, worked but I found out it doesn't authenticate on keyboard-interactive, see log: 
Authentications that can continue: publickey,keyboard-interactive,password
Next authentication method: publickey
Authentications that can continue: keyboard-interactive,password
Next authentication method: keyboard-interactive
Authentications that can continue: password
Next authentication method: password
Authentication succeeded (password).

2. the same as 1 but password authentication disabled 
results: 
doesn't work at all! Cannot connect to ... (Cause: Auth cancel)
This worked from filezilla client for example. 

Authentications that can continue: publickey,keyboard-interactive,password
Next authentication method: publickey
Authentications that can continue: keyboard-interactive,password
Next authentication method: keyboard-interactive
Disconnecting from kenai-test.czech.sun.com port 22
QUIT
Goodbye

3. the same as 2 but private key without passphrase provided 
works as expected 

4. the same as 1 but wrong passphrase and good password; 
works 


conclusion: the only problem is interactive-keyboard auth. that is kinda skipped 
Comment 20 Quality Engineering 2009-07-17 07:02:09 UTC
Integrated into 'main-golden', will be available in build *200907170201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6ea7c62a3484
User: Tomas Mysik <tmysik@netbeans.org>
Log: Additional fix for #166555: sFTP continously prompts for password on upload
Comment 21 Tomas Mysik 2009-07-17 11:08:02 UTC
Fixed, please verify. For the patch, all 3 changesets must be transplanted.
http://hg.netbeans.org/web-main/rev/06a11dfa8111
Comment 22 Filip Zamboj 2009-07-17 11:11:27 UTC
this can be ported to 6.7.1.
Comment 23 Petr Blaha 2009-07-17 11:15:15 UTC
Petre, would you transplant the above 3 CS today? Thanks, P
Comment 24 pgebauer 2009-07-17 12:30:17 UTC
The changesets above are not enough for the port to the release67_fixes branch. The changed class org.netbeans.modules.php.project.connections.sftpSftpClient.java uses org.netbeans.modules.php.api.util.StringUtils.java, however this class isn't part of the 
release67_fixes branch.
Comment 25 Tomas Mysik 2009-07-17 12:38:05 UTC
In NB 6.7, method "hasText(String)" can be found in org.netbeans.modules.php.project.util.PhpProjectUtils class.
Comment 26 pgebauer 2009-07-17 12:44:46 UTC
The fix has been ported into the release67_fixes repository.
http://hg.netbeans.org/release67_fixes/rev/5fb54a31af13
Comment 27 Quality Engineering 2009-07-20 09:47:59 UTC
Integrated into 'main-golden', will be available in build *200907200201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/06a11dfa8111
User: Tomas Mysik <tmysik@netbeans.org>
Log: #166555: sFTP continously prompts for password on upload

Keyboard-interactive should work (for password only).