[ 
https://issues.apache.org/jira/browse/SSHD-1308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17623351#comment-17623351
 ] 

dgü commented on SSHD-1308:
---------------------------

I don't know how SSH servers run remote commands.

If they run remote commands by a shell such as _sh, cmd_ then the workaround 
above may cause addional child shell unless SSH servers are aware of remote 
command is a shell and no need to run its own shell.

If they run remote commands directly without a shell, there will be no 
additionall shell already.

 

This is from _OpenSSH 7.4p1_ on Linux:


{{oracle@ubsia ~]$ pstree}}
{{systemd─┬─NetworkManager───2*[\{NetworkManager}]}}
{{        ├─agetty}}
{{        ├─auditd───\{auditd}}}
{{        ├─chronyd}}
{{        ├─crond}}
{{        ├─dbus-daemon───\{dbus-daemon}}}
{{        ├─gssproxy───5*[\{gssproxy}]}}
{{        ├─lvmetad}}
{{        ├─polkitd───6*[\{polkitd}]}}
{{        ├─rhnsd}}
{{        ├─rsyslogd───2*[\{rsyslogd}]}}
{{        ├─smartd}}
{{        ├─sshd─┬─sshd───sshd───bash───pstree}}
{{        │      ├─sshd───sshd───bash───rman───oracle  <-- RMAN MANUALLY}}
{{        │      ├─sshd───sshd───bash}}
{{        │      └─sshd───sshd───rman───oracle         <-- RMAN BY MINA SSHD by 
}}{{sh -c '...' }}{{}}
{{        ├─systemd-journal}}
{{        ├─systemd-logind}}
{{        ├─systemd-udevd}}
{{        └─tuned───4*[\{tuned}]}}
{{[oracle@ubsia ~]$  }}

 

As seen above there is no additional _sh_ command in the process tree when 
remote command is run by sh -c '...'. OpenSSH Server may have optimized it, or 
something else that I don't know.

This is out of the topic. I wrote if someone needs in future.

> No exception is thrown if setting environment variable is ignored by SSH 
> server
> -------------------------------------------------------------------------------
>
>                 Key: SSHD-1308
>                 URL: https://issues.apache.org/jira/browse/SSHD-1308
>             Project: MINA SSHD
>          Issue Type: Improvement
>    Affects Versions: 2.9.1
>         Environment: Java 8
>            Reporter: dgü
>            Priority: Major
>
> Hello!
> If an environment variable set by 
> _org.apache.sshd.client.session.ClientSession#createExecChannel(command,null,env)_
>  is ignored by SSH server and exit code returns 0, then this may cause 
> unexpected behaviour in client application.
> For example, client application may do different tasks when an environment 
> variable is set and not set. In both cases, client application may return 0. 
> Client application may assume that it worked successfully. But, indeed its 
> environment variable is ignored and worked as if environment variable is not 
> set.
> is it possible throw an exception if setting environment variable is ignored 
> by SSH server ?
> Thanks in advance...
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to