Topic "Connection has been unexpectedly closed. Server sent command"

Author Message
LordJezo

Guest


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

Connection has been unexpectedly closed. Server sent command exit status 1.




Any idea why I would be getting that message when connecting to some servers and not to others?

I tried a manual transfer to the machine in question using PuttySCP, I sent a file from my local machine to the remote one that give the WinSCP error. Everything works fine and the file is moved with no issue. I try WinSCP again and it refuses to connect.

I checked my shell:

/usr/bin/bash

I'm set up to use bash.

Any ideas?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Please post a log file or try to use SFTP instead of SCP.
_________________
Martin Prikryl
LordJezo

Guest


Oh, you know, looking through the options I changed the shell to /bin/ksh and it worked. That's pretty strange.

How would I get a log file, for future reference?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
LordJezo wrote:
How would I get a log file, for future reference?

Please read documentation.
_________________
Martin Prikryl
hawstom
[View user's profile]

Joined: 2007-05-15
Posts: 5
Location: USA
I discovered WinSCP 4.0.0 Beta a couple of weeks ago and I love editing remotely using it!

I have an account at Hostmonster I am using it for. And I have an account at JaguarPC I can connect to with it.

But...

I have an account at JaguarPC where I cannot connect using SCP. Can you help me connect?

-I can connect using FTP (but editing and saving doesn't seem to work in FTP mode).
-JaguarPC tech support can connect to the account using WinSCP 3.7.6 and SCP after renaming .bashrc and .bash_profile
-I tried both version 4.0.0 Beta and 3.8.2 and can't connect.

Here is my log:
. 2007-05-15 15:42:58.328 --------------------------------------------------------------------------
. 2007-05-15 15:42:58.328 WinSCP Version 4.0.0 (Build 342) (OS 5.1.2600 Service Pack 2)
. 2007-05-15 15:42:58.328 Login time: Tuesday, May 15, 2007 3:42:58 PM
. 2007-05-15 15:42:58.328 --------------------------------------------------------------------------
. 2007-05-15 15:42:58.328 Session name: jconstru@constructionnotesmanager.com
. 2007-05-15 15:42:58.328 Host name: constructionnotesmanager.com (Port: 22)
. 2007-05-15 15:42:58.328 User name: jconstru (Password: Yes, Key file: No)
. 2007-05-15 15:42:58.328 Tunnel: No
. 2007-05-15 15:42:58.328 Transfer Protocol: SCP
. 2007-05-15 15:42:58.328 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2007-05-15 15:42:58.328 Proxy: none
. 2007-05-15 15:42:58.328 SSH protocol version: 2; Compression: No
. 2007-05-15 15:42:58.328 Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2007-05-15 15:42:58.328 Ciphers: aes,blowfish,3des,WARN,des; Ssh2DES: No
. 2007-05-15 15:42:58.328 SSH Bugs: -,-,-,-,-,-,-,-
. 2007-05-15 15:42:58.328 SFTP Bugs: -,-,-
. 2007-05-15 15:42:58.328 Return code variable: Autodetect; Lookup user groups: Yes
. 2007-05-15 15:42:58.328 Shell: default, EOL: 0
. 2007-05-15 15:42:58.328 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2007-05-15 15:42:58.328 Alias LS: No, Ign LS warn: Yes, Scp1 Comp: No
. 2007-05-15 15:42:58.328 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2007-05-15 15:42:58.328 Cache directory changes: Yes, Permanent: Yes
. 2007-05-15 15:42:58.328 DST mode: 1
. 2007-05-15 15:42:58.328 --------------------------------------------------------------------------
. 2007-05-15 15:42:58.343 Looking up host "constructionnotesmanager.com"
. 2007-05-15 15:42:58.734 Connecting to 207.210.81.210 port 22
. 2007-05-15 15:42:59.218 Server version: SSH-1.99-OpenSSH_3.9p1
. 2007-05-15 15:42:59.218 We claim version: SSH-2.0-WinSCP_release_4.0
. 2007-05-15 15:42:59.218 Using SSH protocol version 2
. 2007-05-15 15:42:59.343 Doing Diffie-Hellman group exchange
. 2007-05-15 15:42:59.609 Doing Diffie-Hellman key exchange
. 2007-05-15 15:43:00.031 Host key fingerprint is:
. 2007-05-15 15:43:00.031 ssh-rsa 1024 c9:5d:66:b1:da:35:5f:aa:d2:7f:62:14:be:c0:b0:e7
. 2007-05-15 15:43:00.031 Initialised AES-256 client->server encryption
. 2007-05-15 15:43:00.031 Initialised HMAC-SHA1 client->server MAC algorithm
. 2007-05-15 15:43:00.031 Initialised AES-256 server->client encryption
. 2007-05-15 15:43:00.031 Initialised HMAC-SHA1 server->client MAC algorithm
! 2007-05-15 15:43:00.296 Using username "jconstru".
. 2007-05-15 15:43:00.406 Session password prompt (jconstru@constructionnotesmanager.com's password: )
. 2007-05-15 15:43:00.406 Using stored password.
. 2007-05-15 15:43:00.406 Sent password
. 2007-05-15 15:43:00.531 Access granted
. 2007-05-15 15:43:00.640 Opened channel for session
. 2007-05-15 15:43:00.750 Started a shell/command
. 2007-05-15 15:43:00.750 --------------------------------------------------------------------------
. 2007-05-15 15:43:00.750 Using SCP protocol.
. 2007-05-15 15:43:00.750 Doing startup conversation with host.
. 2007-05-15 15:43:00.750 Skipping host startup message (if any).
> 2007-05-15 15:43:00.750 echo "WinSCP: this is end-of-file:0"
. 2007-05-15 15:43:01.984 Server sent command exit status 1
. 2007-05-15 15:43:01.984 All channels closed. Disconnecting
. 2007-05-15 15:43:01.984 Server closed network connection
* 2007-05-15 15:43:02.015 (ESshFatal) Connection has been unexpectedly closed. Server sent command exit status 1.
* 2007-05-15 15:43:02.015 Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).
TS

Guest


As Martin alluded, this is not a problem with SFTP. However, with SCP the client has to be smart enough to ignore whatever your /etc/profile, .bashrc, .bashprofile, .login, etc. files may print out during the login process. If any of these generate unexpected output, or if they ask a question that requires input (under the mistaken assumption the shell is always interactive), the scp client will fail to execute the scp program and you'll get an error like the one you posted.

To fix the problem, you can either use SFTP instead of SCP (SFTP is better anyway), or you can change your .-files to not generate output / require input to/from non-interactive shells.

If the .-files were provided by your ISP and you've never changed them, you can probably explain the situation to your ISP and they should be able to edit your .-files so that they check for interactivity before printing or asking questions. For bash, interactive commands should go in ~/.bashrc, which is not (by default) sourced by non-interactive shells.
hawstom
[View user's profile]

Joined: 2007-05-15
Posts: 5
Location: USA
You resolved my issue by suggesting SFTP! Thanks for telling me that SFTP is better anyway!

SCP still doesn't work. A question:

1.
Yes, my dad did change the /etc/profile, .bashrc, .bashprofile, .login files to echo stuff, etc. And initially that was an issue for WinSCP. But we have disabled all that. If I use Putty to log into an SSH shell and I don't get any prompts, wouldn't that indicate all clear on that issue?

Tom
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
hawstom wrote:
Yes, my dad did change the /etc/profile, .bashrc, .bashprofile, .login files to echo stuff, etc. And initially that was an issue for WinSCP. But we have disabled all that. If I use Putty to log into an SSH shell and I don't get any prompts, wouldn't that indicate all clear on that issue?

No that wouldn't. PuTTY is just a terminal application, it does not interpret the outgoing data in anyway, it just displays them. While WinSCP needs to interpret them and naturally it cannot interpret your own messages.
_________________
Martin Prikryl
hawstom
[View user's profile]

Joined: 2007-05-15
Posts: 5
Location: USA
Thanks for taking the time to give that great explanation.

Tom
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License