Cannot Run Local Bash Script on Remote System with Ssh -Tt

Having trouble with bash. Essentially there are two Redhat nodes, WS01 and DEV01. The script on WS01 that I want to run on DEV01 asks for certain info prompts through a read -p. Expect is not installed and cannot be (unfortunately).

When I enter...

ssh root@DEV01 /path/to/script.sh

it returns (BoKS message)

no terminal authorization granted

If I do...

ssh -tt root@DEV01 /patch/to/script.sh

it returns

TERM: not defined
Illegal variable name

Script runs fine when run through a regular ssh session though. Checked term with echo $TERM and it was set to vt100 on both systems. Default shell is csh on both systems so I thought it was defaulting to that. tried to put variations of calling bash in the ssh command but everything showed the same results.

Other variations of that ssh command (Feels like I've tried most of them) have unfortunately also given the same results.

Also tried

ssh -tt root@DEV01 "$(< script.sh)"

and basically anything else I could find on the internet and still nothing. Beating my head against the wall at this point.

Ultimately I just need a way to run a bash script that is local on the machine, onto a remote host, and that allows an interactive shell that will let the user input data when it prompts for it. Thanks in advance for the help.

2

1 Answer

The script is MOST LIKELY trying to manipulate the terminal in which the script output is being displayed. In your case, your terminal from which you are ssh(ing) into your script. For example, rewrite previously written output on the terminal. Linux packages such as ncurses comes with functions such as tput that allows you to rewrite terminal output.

This would be useful when say, a processing action wants to display progress and replace that line after processing is completed to display that the action was successful.

Example: let's say a file copy is in progress. And your terminal might display

file copy in progress ...

and this line would be replaced or appended to at the end of the operation to read

file copy completed!

You would need to remove the terminal manipulation lines from the ssh script file OR provide the necessary permissions (which is impossible in many cases).

Your Answer

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

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest