2

Scenario: Source host (Solaris 5.10, KSH), im trying to run the following script named sample.ksh on source

#!/bin/ksh
set -x
Rediscover ()
{
ssh user@hostB ./scripts/test.ksh
}
Rediscover
exit 0

Remote Host: Linux (bash shell), i have the following script called test.ksh

#!/bin/bash -x
resize
stty -a
exit

Issue: I can run the test.ksh without any issues directly on Linux host but when i try to run it remotely from solaris i am getting the follwoing error.

root@hostA# ./sample.ksh
+ Rediscover
+ resize
resize:  can't open terminal /dev/tty
+ stty -a
stty: standard input: Invalid argument
+ exit
+ exit 0

Why can't i see the output of resize and stty -a remotely ??

SSH keys were setup from A to B

  • Together with not being sure about this, I think the tty's play a role when you have an interactive session. By invoking a single script/executable from your ssh command line, you are telling the system, this is not an interactive session. In turn the system disregards the termcap or uses a very minimalistic one and stty command doesn't get involved. Again this is not from any document. Just my understanding. – MelBurslan Feb 9 '16 at 19:07
4

You can force interactive session using -tt switch in your script:

ssh -tt user@hostB ./scripts/test.ksh

Otherwise the TTY on the hostB will not get allocated and you will get such errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.