ssh session hangs while running cmd on remote server

View: New views
13 Messages — Rating Filter:   Alert me  

ssh session hangs while running cmd on remote server

by KenLee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm a Linux newbie, so please excuse my dumb questions.

Installed cygwin successfully on a box running Win2003 server.  When I ssh to it to run a VB script file (.kcu extension) as "cmd /c update.kcu", my client session just hangs until I press Ctrl-C.  Meanwhile on the remote server, nothing happens.  

However, if I run cygwin directly on the box and enter the exact same command, the script file runs no problem.  

Any help would be most appreciated.  

Re: ssh session hangs while running cmd on remote server

by Christopher Faylor-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, May 31, 2007 at 12:46:29PM -0700, KenLee wrote:

>I'm a Linux newbie, so please excuse my dumb questions.
>
>Installed cygwin successfully on a box running Win2003 server.  When I ssh
>to it to run a VB script file (.kcu extension) as "cmd /c update.kcu", my
>client session just hangs until I press Ctrl-C.  Meanwhile on the remote
>server, nothing happens.  
>
>However, if I run cygwin directly on the box and enter the exact same
>command, the script file runs no problem.  
>
>Any help would be most appreciated.  

The question to ask yourself, being a linux newbie is how you would run
a VB script under "cmd /c" on linux.

Give up?

You wouldn't do anything like that under linux because neither VB scripts
nor cmd exist.

So, whatever problem you may be having is probably due to the fact that
cmd and/or VB are not interacting well with the Cygwin ssh environment.
Most likely it doesn't know what to do with Cygwin ptys (another linux
construct).

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: ssh session hangs while running cmd on remote server

by Larry Hall (Cygwin) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

KenLee wrote:

> I'm a Linux newbie, so please excuse my dumb questions.
>
> Installed cygwin successfully on a box running Win2003 server.  When I ssh
> to it to run a VB script file (.kcu extension) as "cmd /c update.kcu", my
> client session just hangs until I press Ctrl-C.  Meanwhile on the remote
> server, nothing happens.  
>
> However, if I run cygwin directly on the box and enter the exact same
> command, the script file runs no problem.  
>
> Any help would be most appreciated.  

See what the "CYGWIN" environment variable is set to in both cases.  If the
'ssh' session has 'tty', you'll want to remove that.  It's probably in the
server's startup environment.  If having 'tty' set is the problem, you
should be able to reproduce it by running the same script from 'rxvt'.

Otherwise, see <http://cygwin.com/problems.html> for a description of the
diagnostic information you should send to the list in any follow-up.

--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: ssh session hangs while running cmd on remote server

by Christopher Faylor-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, May 31, 2007 at 04:08:02PM -0400, Larry Hall (Cygwin) wrote:

>KenLee wrote:
>>I'm a Linux newbie, so please excuse my dumb questions.
>>
>>Installed cygwin successfully on a box running Win2003 server.  When I
>>ssh to it to run a VB script file (.kcu extension) as "cmd /c
>>update.kcu", my client session just hangs until I press Ctrl-C.
>>Meanwhile on the remote server, nothing happens.
>>
>>However, if I run cygwin directly on the box and enter the exact same
>>command, the script file runs no problem.
>>
>>Any help would be most appreciated.
>
>See what the "CYGWIN" environment variable is set to in both cases.  If
>the 'ssh' session has 'tty', you'll want to remove that.  It's probably
>in the server's startup environment.  If having 'tty' set is the
>problem, you should be able to reproduce it by running the same script
>from 'rxvt'.

There seems to be some confusion about the CYGWIN tty setting.

The only time it should have any effect is when there is a console involved.
In that scenario, what effectively happens is that CYGWIN opens up a pty
and pretends that the pty is a linux-like tty.

Setting CYGWIN=tty for servers should be a no-op.  Ditto, having it set
while operating under a pty or if there is no console associated with the
session.

So, if setting CYGWIN=tty actually causes a problem in an ssh session
then that is probably a Cygwin bug.  Until that problem has become evident
lets not assume that there is a problem.

I don't mean to be picking on you Larry.  You are not the only person
I've seen opine about CYGWIN=tty .  I remain unconvinced that setting it
would present a problem other than the standard problem of running pure
Windows programs under a Cygwin pty.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: ssh session hangs while running cmd on remote server

by Larry Hall (Cygwin) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christopher Faylor wrote:

> There seems to be some confusion about the CYGWIN tty setting.
>
> The only time it should have any effect is when there is a console involved.
> In that scenario, what effectively happens is that CYGWIN opens up a pty
> and pretends that the pty is a linux-like tty.
>
> Setting CYGWIN=tty for servers should be a no-op.  Ditto, having it set
> while operating under a pty or if there is no console associated with the
> session.
>
> So, if setting CYGWIN=tty actually causes a problem in an ssh session
> then that is probably a Cygwin bug.  Until that problem has become evident
> lets not assume that there is a problem.
>
> I don't mean to be picking on you Larry.  You are not the only person
> I've seen opine about CYGWIN=tty .  I remain unconvinced that setting it
> would present a problem other than the standard problem of running pure
> Windows programs under a Cygwin pty.
>


The confusion may come from me. ;-)

So are you saying that all Cygwin services effectively use ptys?

Rereading the original post, I note that KenLee only said 'cmd' was started
once in the OpenSSH session.  I also assumed he invoked 'ssh' from a
console, which may make a difference if the answer to the above question
is "no".  But that assumption is unsubstantiated by the available
information. ;-)


--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: ssh session hangs while running cmd on remote server

by Christopher Faylor-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, May 31, 2007 at 04:27:00PM -0400, Larry Hall (Cygwin) wrote:

>Christopher Faylor wrote:
>> There seems to be some confusion about the CYGWIN tty setting.
>>
>> The only time it should have any effect is when there is a console involved.
>> In that scenario, what effectively happens is that CYGWIN opens up a pty
>> and pretends that the pty is a linux-like tty.
>>
>> Setting CYGWIN=tty for servers should be a no-op.  Ditto, having it set
>> while operating under a pty or if there is no console associated with the
>> session.
>>
>> So, if setting CYGWIN=tty actually causes a problem in an ssh session
>> then that is probably a Cygwin bug.  Until that problem has become evident
>> lets not assume that there is a problem.
>>
>> I don't mean to be picking on you Larry.  You are not the only person
>> I've seen opine about CYGWIN=tty .  I remain unconvinced that setting it
>> would present a problem other than the standard problem of running pure
>> Windows programs under a Cygwin pty.
>
>The confusion may come from me. ;-)
>
>So are you saying that all Cygwin services effectively use ptys?
>
>Rereading the original post, I note that KenLee only said 'cmd' was started
>once in the OpenSSH session.  I also assumed he invoked 'ssh' from a
>console, which may make a difference if the answer to the above question
>is "no".  But that assumption is unsubstantiated by the available
>information. ;-)

If he ssh'ed to somewhere interactively then there is a pty involved on
the remote end where the program was being run so that's what would have
caused any problem, IMO, regardless of the CYGWIN tty setting on the
local end.  In that scenario, since ssh is a cygwin program it shouldn't
care about the CYGWIN=tty setting one way or the other.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: ssh session hangs while running cmd on remote server

by KenLee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have tried ssh using both interactive and command line mode, and I get the same results.  That is - sorry for being pedantic about this - I had invoked ssh first with the command line option, and it worked.  I invoked ssh again with the command line again, but it hung this time.  Then I just invoked ssh on its own, and entered the commands one at a time, and it hung again.  

Then I ran cygwin directly on the remote server (thinking that it's the VB script causing the problem), so I entered cmd /c update.kcu (without any ssh) and it worked just fine.  

I checked the CYGWIN setting and it is set to CYGWIN=ntsec tty


Christopher Faylor-8 wrote:
On Thu, May 31, 2007 at 04:27:00PM -0400, Larry Hall (Cygwin) wrote:
>Christopher Faylor wrote:
>> There seems to be some confusion about the CYGWIN tty setting.
>>
>> The only time it should have any effect is when there is a console involved.
>> In that scenario, what effectively happens is that CYGWIN opens up a pty
>> and pretends that the pty is a linux-like tty.
>>
>> Setting CYGWIN=tty for servers should be a no-op.  Ditto, having it set
>> while operating under a pty or if there is no console associated with the
>> session.
>>
>> So, if setting CYGWIN=tty actually causes a problem in an ssh session
>> then that is probably a Cygwin bug.  Until that problem has become evident
>> lets not assume that there is a problem.
>>
>> I don't mean to be picking on you Larry.  You are not the only person
>> I've seen opine about CYGWIN=tty .  I remain unconvinced that setting it
>> would present a problem other than the standard problem of running pure
>> Windows programs under a Cygwin pty.
>
>The confusion may come from me. ;-)
>
>So are you saying that all Cygwin services effectively use ptys?
>
>Rereading the original post, I note that KenLee only said 'cmd' was started
>once in the OpenSSH session.  I also assumed he invoked 'ssh' from a
>console, which may make a difference if the answer to the above question
>is "no".  But that assumption is unsubstantiated by the available
>information. ;-)

If he ssh'ed to somewhere interactively then there is a pty involved on
the remote end where the program was being run so that's what would have
caused any problem, IMO, regardless of the CYGWIN tty setting on the
local end.  In that scenario, since ssh is a cygwin program it shouldn't
care about the CYGWIN=tty setting one way or the other.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Re: ssh session hangs while running cmd on remote server

by Larry Hall (Cygwin) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christopher Faylor wrote:

> On Thu, May 31, 2007 at 04:27:00PM -0400, Larry Hall (Cygwin) wrote:
>> Christopher Faylor wrote:
>>> There seems to be some confusion about the CYGWIN tty setting.
>>>
>>> The only time it should have any effect is when there is a console involved.
>>> In that scenario, what effectively happens is that CYGWIN opens up a pty
>>> and pretends that the pty is a linux-like tty.
>>>
>>> Setting CYGWIN=tty for servers should be a no-op.  Ditto, having it set
>>> while operating under a pty or if there is no console associated with the
>>> session.
>>>
>>> So, if setting CYGWIN=tty actually causes a problem in an ssh session
>>> then that is probably a Cygwin bug.  Until that problem has become evident
>>> lets not assume that there is a problem.
>>>
>>> I don't mean to be picking on you Larry.  You are not the only person
>>> I've seen opine about CYGWIN=tty .  I remain unconvinced that setting it
>>> would present a problem other than the standard problem of running pure
>>> Windows programs under a Cygwin pty.
>> The confusion may come from me. ;-)
>>
>> So are you saying that all Cygwin services effectively use ptys?
>>
>> Rereading the original post, I note that KenLee only said 'cmd' was started
>> once in the OpenSSH session.  I also assumed he invoked 'ssh' from a
>> console, which may make a difference if the answer to the above question
>> is "no".  But that assumption is unsubstantiated by the available
>> information. ;-)
>
> If he ssh'ed to somewhere interactively then there is a pty involved on
> the remote end where the program was being run so that's what would have
> caused any problem, IMO, regardless of the CYGWIN tty setting on the
> local end.  In that scenario, since ssh is a cygwin program it shouldn't
> care about the CYGWIN=tty setting one way or the other.


Understood.  Thanks.


--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: ssh session hangs while running cmd on remote server

by Larry Hall (Cygwin) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

KenLee wrote:

> I have tried ssh using both interactive and command line mode, and I get the
> same results.  That is - sorry for being pedantic about this - I had invoked
> ssh first with the command line option, and it worked.  I invoked ssh again
> with the command line again, but it hung this time.  Then I just invoked ssh
> on its own, and entered the commands one at a time, and it hung again.  
>
> Then I ran cygwin directly on the remote server (thinking that it's the VB
> script causing the problem), so I entered cmd /c update.kcu (without any
> ssh) and it worked just fine.  
>
> I checked the CYGWIN setting and it is set to CYGWIN=ntsec tty
>

As Chris mentioned, the 'tty' setting would only have an effect when you
went to the remote server and ran the command there.  Since you saw no
problem doing that, that indicates ptys aren't an issue here.  Is the
Windows 'rsh' command available on the server?  If so, you could use it
to determine if the VB script does something that just isn't reliable
remotely.


--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: ssh session hangs while running cmd on remote server

by KenLee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes the rsh client is present on the Windows side.  But I don't have a rsh daemon running as a service.  Now I have to go hunt down the instructions to get that up and running.......  
Larry Hall (Cygwin) wrote:
KenLee wrote:
> I have tried ssh using both interactive and command line mode, and I get the
> same results.  That is - sorry for being pedantic about this - I had invoked
> ssh first with the command line option, and it worked.  I invoked ssh again
> with the command line again, but it hung this time.  Then I just invoked ssh
> on its own, and entered the commands one at a time, and it hung again.  
>
> Then I ran cygwin directly on the remote server (thinking that it's the VB
> script causing the problem), so I entered cmd /c update.kcu (without any
> ssh) and it worked just fine.  
>
> I checked the CYGWIN setting and it is set to CYGWIN=ntsec tty
>

As Chris mentioned, the 'tty' setting would only have an effect when you
went to the remote server and ran the command there.  Since you saw no
problem doing that, that indicates ptys aren't an issue here.  Is the
Windows 'rsh' command available on the server?  If so, you could use it
to determine if the VB script does something that just isn't reliable
remotely.


--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Re: ssh session hangs while running cmd on remote server

by Albrecht Schlosser-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

KenLee wrote:

> I have tried ssh using both interactive and command line mode, and I get the
> same results.  That is - sorry for being pedantic about this - I had invoked
> ssh first with the command line option, and it worked.  I invoked ssh again
> with the command line again, but it hung this time.  Then I just invoked ssh
> on its own, and entered the commands one at a time, and it hung again.  
>
> Then I ran cygwin directly on the remote server (thinking that it's the VB
> script causing the problem), so I entered cmd /c update.kcu (without any
> ssh) and it worked just fine.  
>  
Maybe it doesn't "hang" at all ...

Something I can see is that a (windows console) program _seems_ to hang,
but actually it doesn't. stdout seems to be (block) buffered when run
from an xterm or rxvt session, but unbuffered when run from a local
standard cygwin window.

One test to see what happens would be to run the program with stdin
redirected to /dev/null to get an error message:

cmd /c update.kcu < /dev/null

When I do this, I can see the program's prompt and some output that
would be missing otherwise.

What happens, if you do that ?

Albrecht

P.S. BTW: Is there a way to set stdout to unbuffered without modifying
the windows console program?


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: ssh session hangs while running cmd on remote server

by Larry Hall (Cygwin) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Albrecht Schlosser wrote:

<snip>

> P.S. BTW: Is there a way to set stdout to unbuffered without modifying
> the windows console program?

See the previous discussion in this thread, doc on the 'tty' setting, and
ptys.

--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: ssh session hangs while running cmd on remote server

by Morgan Gangwere :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Larry Hall (Cygwin) wrote:

> Christopher Faylor wrote:
>> On Thu, May 31, 2007 at 04:27:00PM -0400, Larry Hall (Cygwin) wrote:
>>> Christopher Faylor wrote:
>>>> There seems to be some confusion about the CYGWIN tty setting.
>>>>
>>>> The only time it should have any effect is when there is a console involved.
>>>> In that scenario, what effectively happens is that CYGWIN opens up a pty
>>>> and pretends that the pty is a linux-like tty.
>>>>
>>>> Setting CYGWIN=tty for servers should be a no-op.  Ditto, having it set
>>>> while operating under a pty or if there is no console associated with the
>>>> session.
>>>>
>>>> So, if setting CYGWIN=tty actually causes a problem in an ssh session
>>>> then that is probably a Cygwin bug.  Until that problem has become evident
>>>> lets not assume that there is a problem.
>>>>
>>>> I don't mean to be picking on you Larry.  You are not the only person
>>>> I've seen opine about CYGWIN=tty .  I remain unconvinced that setting it
>>>> would present a problem other than the standard problem of running pure
>>>> Windows programs under a Cygwin pty.
>>> The confusion may come from me. ;-)
>>>
>>> So are you saying that all Cygwin services effectively use ptys?
>>>
>>> Rereading the original post, I note that KenLee only said 'cmd' was started
>>> once in the OpenSSH session.  I also assumed he invoked 'ssh' from a
>>> console, which may make a difference if the answer to the above question
>>> is "no".  But that assumption is unsubstantiated by the available
>>> information. ;-)
>> If he ssh'ed to somewhere interactively then there is a pty involved on
>> the remote end where the program was being run so that's what would have
>> caused any problem, IMO, regardless of the CYGWIN tty setting on the
>> local end.  In that scenario, since ssh is a cygwin program it shouldn't
>> care about the CYGWIN=tty setting one way or the other.
>
>
> Understood.  Thanks.
>
>

ok. can you run this command successfully from the ACCTUAL machine? i
mean, without ssh or something - like over VNC?

if it dosnt work when you have the native machine running it from a more
local (more local meaning not over SSH, but with some means of actually
controlling the machine)

If at all else, run it on a clone machine with a real kb and mouse.

PS: are you SURE you want to use "cmd" and not the native VBScript system?

- --
Just a Thought
Morgan Gangwere

For those who want my PGP key:
http://pengunassasin.kicks-ass.org/pgpKey.html

******* Wisdom for the day *******
* Dont rawquote - it gives       *
*          spammers free bait!   *
**********************************
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGYJurCF9T/dUsmAgRAhHMAJ9CnjwyNQqTuIFuF7FubgvoKYyUiACfeyQQ
iGlOWRisqGlTsQnxZzqD1Kw=
=ApgW
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/