"Cannot initialize SFTP protocol. Is the host running a SFTP server?" WinSCP error when the server requires "two passwords"
Asked Answered
C

7

9

When I try to SSH into my cluster, there are two stages. So I have to enter the password twice to go to my home directory using SSH in a Linux terminal or PuTTY.

But when I try to use WinSCP, I get these errors:

Trying SFTP:

Cannot initialize SFTP protocol. Is the host running a SFTP server?

Trying SCP:

Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).

How can I bypass this problem?

Chanell answered 23/11, 2014 at 19:18 Comment(0)
G
18

In WinSCP I just changed the File protocol option from "SFTP" to "SCP" and file transfer is started working now.

enter image description here

Gyno answered 1/5, 2018 at 9:14 Comment(0)
M
7

I believe it will resolve your issue

Most of the time it happened due to the password expired . So you need to make do right click on that WinSCP user's and you'll find the option Open in PUTTY, PFA. enter image description here

After PuTTY opened, Enter Your Current Password and it will ask to reset New Password. And you will get access successfully, its worked for me :)

                                   ..
Mop answered 24/6, 2021 at 6:23 Comment(2)
In my case i was logging in using wrong user name - "root" instead of "ubuntu"Primacy
This worked for me. Even though I was using a passwordless public/private key to authenticate to the Linux server, I had to use this option (logging in through putty) and type my new Active Directory password after my AD credential were forced expired.Accalia
P
6

Actually, this error may be misleading in some cases. Assuming that SSH works (which is the case for you), it could simply be the fact that your bash is outputting some text which breaks SCP.

Once you SSH into your system, is there some text printed? (Example some welcome text). If that is the case, you could put a test in your ~/.bashrc (or whatever script is first loaded, like ~/.bash_profile on some systems) and check if the shell is interactive or not. If not interactive, do not print anything. You can use this to skip printing anything (put this at the beginning of .bashrc) :

#Detect if in SCP
if [ -z "$PS1" ]; then
    return
fi
Parker answered 26/3, 2018 at 17:0 Comment(3)
Your question about the error message from the question. But the question is explicitly about OP "hav(ing) to enter the password twice to go to my home directory"Peterus
If I understood correctly, that's the case with Putty. Login does not work with WinSCP and I got the same errors. The solution I provided fixed my problem. I hope it helps others.Parker
This was indeed the case for me. Setup script by FPGA vendor that I added to .bashrc was printing out quite a few environment variables. When I commented it out I was able to use WinSCP again to login. This raises a quiestion about robustness of the WinSCP login interface. In this interface an assumption was made about the smaller size of the initial login terminal messages followed by an excuse of diagnostic message telling you that they do not know what is really going on. This is a genuine bug and should be filed against this piece of Software.Yeung
J
2

Issue: We get this error while accessing SFTP server through WIndows 10 machine: Cannot initialize SFTP protocol. Is the host running a SFTP server? WinSCP error

Solution: Provide the path of the SFTP server, as shown in a screenshot:

Janettjanetta answered 22/12, 2021 at 12:59 Comment(1)
That's not a solution. That's a workaound for a misconfigured SFTP server. Have the server fixed instead. And it's definitelly not an answer to the question, which is about two passwords.Peterus
P
0

For general information, read documentation on the error message Cannot initialize SFTP protocol. Is the host running a SFTP server?

Though for your particular case, the problem is likely caused by the server not being able to talk to WinSCP for exchange of the second password. What is the second password for? The sudo? Or an SSH tunnel to a second "stage" (whatever that is)?

For sudo/su, refer to the WinSCP FAQ How do I change user after login (e.g. su root)?

For tunneling, refer to the tunneling documentation.

I'm aware that this is bit vague answer, but so is your question. If you describe, what the two passwords are for, and if you share a session log file, you might get better answers.

Peterus answered 23/11, 2014 at 21:16 Comment(0)
L
0

I was having the same issue but I just switched the File Protocol from SFTP to regular FTP and it worked.

Lingo answered 23/7, 2020 at 23:49 Comment(0)
B
-1

These are different types of error that we get on WINSCP-

  1. WARNING: Your password has expired OR
  2. Cannot initialize SFTP protocol. Is the host running an SFTP server? OR
  3. Authentication Failed.

Try the below mentioned methods to resolve the above errors:

Change File Protocol from SFTP to SCP

As the error itself says there is a problem with the SFTP protocol so try changing the File Protocol first. Explained below:

Click on edit -> choose SCP from the dropdown menu given for File Protocol -> click on save and then login

Reset the Password using PuTTY

If still the problem is not resolved then finally you have the last option to reset the password using PuTTY.

PFB Steps -

  1. Right click on the current site/server/user of WINSCP -> select "Open in PuTTY" option OR Select the current site/server/user of WINSCP -> press Ctrl+P

  2. When PuTTY is opened, enter your password and then it will ask you to enter a new password.

Note: Password will not be visible to you, so enter them carefully.

You can then use the new password to login. It will work for sure.

Barretter answered 12/7, 2021 at 16:46 Comment(1)
The question is about authentication with two passwords. It's not generic question about the "Cannot initialize SFTP protocol. Is the host running a SFTP server?" error.Peterus

© 2022 - 2024 — McMap. All rights reserved.