Launching remote command fails if command must be set in initial request [message #758636] |
Thu, 24 November 2011 02:43 |
Rob Stryker Messages: 2 Registered: July 2009 |
Junior Member |
|
|
Hi All:
I was having some problems setting up my newsgroups (outdated
thunderbird), so this is a crosspost from a bugzilla
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=364665). But since this
is more a useage error so far, I should have messaged here to get ideas
first before opening a bugzilla.
Given a remote server with the following characteristics:
1) Rejects ssh connections with no attached command
2) Rejects ssh connections if the attached command is not an approved
command
From the CLI, the following commands give the following output:
1) Command: ssh user@host
Output: Connections require an approved command
2) Command: ssh user@host 'ls'
Output: Invalid command ls
3) Command: ssh user@host 'tail folder/i/own/*'
Output: (expected output, tail of files, etc)
When using RSE, the server's response is always the one from example
1... as if an initial command is not set when connecting to the host.
My first attempt to fix it involved drilling down into
IShellService.runCommand(etc). It is there revealed that the code in
TerminalShellService.runCommand(etc) includes the following:
ITerminalShell terminalShell = fTerminalService.launchTerminal("vt100",
encoding, environment, initialWorkingDirectory, null, monitor);
TerminalServiceHostShell hostShell = new TerminalServiceHostShell(
terminalShell, initialWorkingDirectory, command, environment);
IT is clear here that the first command to launch the ITerminalShell
passes null in as the command. It clearly tries to create a terminal
with no command, then create a shell out of it. This would explain the
rejection by the server, as the server will reject all ssh connections
with no command.
In my own code, I attempted the following:
SshTerminalService sshTerminalService =
(SshTerminalService)terminalService;
tshell = new
SshTerminalShell(sshTerminalService.getSessionProvider(), "vt100",
null, new String[]{}, null, command);
This is to force the command to be passed into the first shell command.
However, even in this situation, the remote host still replies with
"Connections require an approved command", the output from use-case 1.
I am left with no way to simulate ssh user@host 'tail *.txt', or
something similar.
Anyone have any ideas?
|
|
|
Powered by
FUDForum. Page generated in 0.02033 seconds