Bug 784225 - ssh bug while executing remote ssh command
Summary: ssh bug while executing remote ssh command
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: openssh
Version: 5.3
Hardware: Unspecified
OS: Linux
unspecified
urgent
Target Milestone: rc
: ---
Assignee: Petr Lautrbach
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-24 10:55 UTC by sunil
Modified: 2023-09-14 01:27 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-02 13:23:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description sunil 2012-01-24 10:55:07 UTC
Description of problem:

while invoking remote shell script through ssh from rhel 5 to rhel 5 I am getting error "tcgetattr: Invalid argument" I try like this "ssh -t -t -l user host "./shell script".

same process is working fine if I invoke it from solaris to linux. 


Version-Release number of selected component (if applicable):
rhel5

How reproducible:

like just try to start a java process remotely. 

Steps to Reproduce:
1.local script contains ssh command and remote script to execute
2.run local script it ssh and start the process .
3. its unable to feed result to orginated program ( source ssh connection ) instead gives error "tcgetattr: Invalid argument" 
  
Actual results:


Expected results:


Additional info:

Comment 1 Stephen Gallagher 2012-01-24 12:10:34 UTC
Reassigning to the openssh component. This has nothing to do with SSSD.

Comment 2 Miroslav Vadkerti 2012-01-25 11:01:38 UTC
Thanks for the report sunil. I can reproduce the problem using the reproducer below (the part with the error), although in my case the commands get executed correctly. Please note that I think you have to pipe the commands to ssh instead of passing the local script.

[root@machine1 ~]# cat test
echo $HOSTNAME
exit

[root@machine1 ~]# cat test | ssh -t -t root@machine2
root@machine2's password: 
tcgetattr: Invalid argument
Last login: Wed Jan 25 05:52:46 2012 from machine1
[root@machine2 ~]# echo $HOSTNAME
machine2
[root@machine2 ~]# exit
logout
Connection to machine2 closed.

Comment 3 Petr Lautrbach 2012-01-25 12:48:25 UTC
(In reply to comment #0)
> Description of problem:
> 
> while invoking remote shell script through ssh from rhel 5 to rhel 5 I am
> getting error "tcgetattr: Invalid argument" I try like this "ssh -t -t -l user
> host "./shell script".
> 

Why do you need "-t -t"? Is there any other input in source ssh script then terminal?

> 
> Steps to Reproduce:
> 1.local script contains ssh command and remote script to execute
> 2.run local script it ssh and start the process .
> 3. its unable to feed result to orginated program ( source ssh connection )
> instead gives error "tcgetattr: Invalid argument" 
> 

Running and capturing output of remote scripts/commands works as expected even with "-t -t":

$ echo $date
$ date=`ssh -t -t localhost date`
user@localhost's password:
Connection to localhost closed.
$ echo $date
Wed Jan 25 13:42:25 CET 2012

Comment 4 Petr Lautrbach 2012-01-25 12:50:59 UTC
(In reply to comment #2)
> Thanks for the report sunil. I can reproduce the problem using the reproducer
> below (the part with the error), although in my case the commands get executed
> correctly. Please note that I think you have to pipe the commands to ssh
> instead of passing the local script.
> 
> [root@machine1 ~]# cat test
> echo $HOSTNAME
> exit
> 
> [root@machine1 ~]# cat test | ssh -t -t root@machine2
> root@machine2's password: 
> tcgetattr: Invalid argument
> Last login: Wed Jan 25 05:52:46 2012 from machine1
> [root@machine2 ~]# echo $HOSTNAME
> machine2
> [root@machine2 ~]# exit
> logout
> Connection to machine2 closed.

If you need to run local script on remote system then you should add remote shell as command instead of running remote login shell:

$ cat > test
date
exit
$ cat test | ssh localhost bash
user@localhost's password:
Wed Jan 25 13:49:39 CET 2012
$

Comment 5 sunil 2012-01-27 07:50:31 UTC
A simple local command has no issue like date, ls, cat etc..Sorry I didn't elaborate much earlier..

I don't not see output or its broken after that mentioned error.

the output when I run certain (shell script that invokes java process) daemons in debug or interactive mode on remote server from a local script with ssh command to remote.

moreover, I am invoking local shell script from a cgi interface through web browser that ssh to remote host and execute a process there. 

same coding same configuration is running fine if I hit request from a solaris server to rhel5 without any error .. but from rhel5 to rhel5 it gives error. 

I think its rhel family issue , pls look at below url:

http://docs.fedoraproject.org/en-US/Fedora/13/html/SELinux_FAQ/index.html#id3028932

Comment 6 Petr Lautrbach 2012-03-05 14:57:44 UTC
Why do use use '-t -t'? Do you need terminal? Is the stdout and stderr connected to ssh process sufficient? Does it work without '-t -t'?

If it is SELinux related, it should work with SELinux permissive mode:

# setenforce 0

If it work, you can find SELinux AVC messages in audit log or via  this command:

# ausearch -m avc -ts recent

Comment 7 Roy Keene 2012-09-28 15:51:58 UTC
I can confirmed this issue is still present in RHEL 5.8 as well as RHEL 6.3.

We have a script which runs from "cron" (and thus has no local tty) which needs a remote tty (default "sudo" configuration still exists on some hosts).

We capture both standard output and standard error in the process and the error message being printed on standard error is annoying.

To reproduce:
        $ ssh -qtt localhost tty </dev/null
        tcgetattr: Inappropriate ioctl for device
        /dev/pts/2


This bug is not present in stock OpenSSH 5.5p1:
        $ ssh -qtt localhost tty </dev/null
        /dev/pts/5
        $ ssh -v
        OpenSSH_5.5p1, OpenSSL 0.9.8x 10 May 2012

Comment 8 RHEL Program Management 2014-03-07 13:56:43 UTC
This bug/component is not included in scope for RHEL-5.11.0 which is the last RHEL5 minor release. This Bugzilla will soon be CLOSED as WONTFIX (at the end of RHEL5.11 development phase (Apr 22, 2014)). Please contact your account manager or support representative in case you need to escalate this bug.

Comment 9 RHEL Program Management 2014-06-02 13:23:41 UTC
Thank you for submitting this request for inclusion in Red Hat Enterprise Linux 5. We've carefully evaluated the request, but are unable to include it in RHEL5 stream. If the issue is critical for your business, please provide additional business justification through the appropriate support channels (https://access.redhat.com/site/support).

Comment 10 Red Hat Bugzilla 2023-09-14 01:27:10 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


Note You need to log in before you can comment on or make changes to this bug.