• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 877
  • Last Modified:

ssh and "stderr is not a tty - where are you?"

I want to apply a sequence of commands to a load of servers. It is a relatively complicated sequence of commands including su-ing as a different user, killing a process, exiting, installing a Slackware package, which has a post-installation script, su-ing as a different user again, starting a daemon, sleeping a couple of seconds and then tailing a log file to check that the daemon is healthy.

To apply the command to many servers, I have a BASH for loop which changes $server and executes the sequence of commands using SSH as follows:

    ssh root@$server "blah; blah; blah"

All I need to do is to paste the root password and I'm in business.

However, one of my commands is throwing up the error: "stderr is not a tty - where are you?". Evidently one of the commands is checking stderr and getting disappointed. Rather than sorting out the command which is the culprit, is there something I can do with SSH to avoid this?
0
rstaveley
Asked:
rstaveley
  • 2
1 Solution
 
cjl7Commented:
Hi,

I'd do it the other way around...

for i in `cat servers.txt`
do
cat your_super_script.sh | ssh root@$server /bin/bash
done

But I don't know if that helps at all...

I'm using ssh in a simular way, but I use ssh-keys in order to not type passwords...

//jonas
0
 
ravenplCommented:
use -t option to the ssh
ssh -t root@$server "blah; blah; blah"
0
 
rstaveleyAuthor Commented:
That works, Jonas. Many thanks. Oddly enough I still see the "stderr is not a tty - where are you?", but it isn't a show-stopper.

> I use ssh-keys in order to not type passwords

I would if I could but I keep losing the argument about that approach with our main admin, who unceremoniously zaps my .ssh/authorized_keys2 entries 8-)
0
 
rstaveleyAuthor Commented:
ravenpl, the -t option gets me a warning:

   Pseudo-terminal will not be allocated because stdin is not a terminal.

...and doesn't seem to make any difference otherwise.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now