2

This command use to work on RHEL5.8, however since we upgraded to 6.5 (bash version 4.1.2) it started outputting the following: 'unknown': unknown terminal type.

sudo su - *user* -c "ssh *remoteserver* 'sudo /etc/init.d/server1.sh status'"
'unknown': unknown terminal type.
'unknown': unknown terminal type.
SERVER Status: 'unknown': unknown terminal type.
                                     Running

Expected output is

SERVER Status:           Running

Note: When I use ssh -t it works, but im trying to avoid terminal clearing and extra output: Connection to remoteserver closed.

Motorahead
  • 75
  • 1
  • 6
  • 2
    The user's `.bashrc` isn't checking whether it's being run with a terminal, so it's trying to execute commands that need a terminal. – Barmar Apr 30 '15 at 23:42
  • 3
    That's why it works with `ssh -t`. – Barmar Apr 30 '15 at 23:44
  • 2
    If you're not sure which commands in the `.bashrc` are doing this, put `set -x` at the top of the script. It will show each command as it's executed, then you can see where the errors happen. And in case it's not obvious, I'm talking about the script on the remote server. – Barmar Apr 30 '15 at 23:45
  • Thanks, however the script on the remote server is not the problem. It executes fine. I believe the problem resides in the with the ssh section of the command. Is there another way to acomplish this without ssh -t? Like I said, I want to avoid the disconnection output from a -t. – Motorahead May 04 '15 at 20:07
  • I'm not talking about the `server1.sh` script, I'm talking about the shell startup scripts. Those messages are NOT coming from `ssh` itself. – Barmar May 04 '15 at 20:13
  • Ah sorry, I see what you're saying. The set -x was very helpful. ++ su - user -c 'env | grep ^VER_HOME=' ++ awk -F= '{print $2}' 'unknown': unknown terminal type. – Motorahead May 04 '15 at 20:46

0 Answers0