Can commands be directly executed from the ssh-server?

0 votes
asked Nov 4, 2015 by Thomas D (120 points)
edited Nov 5, 2015 by Tomas Knopp

Hello,
i try to implement an ssh server with rebex.
I added to the example the ShellCommand EventHandler so i could react on commands like:

if (e.Command == "hello") { ....

But can i execute all commands (like on an real ssh-server) directly in windows so my users can use all available windows commands like "type", "wscript" etc... ?

Best regards,

Thomas

1 Answer

0 votes
answered Nov 5, 2015 by Tomas Knopp (58,890 points)

Hello,

in Rebex File Server there are currently only a few simple SSH Unix-like commands that are supported out-of-the-box as 'hello', 'echo', 'whoami', 'ls', 'cd', ... To get all of them, just write "help" and a list of supported commands will pop up.

Adding support for additional commands, be it windows-like or unix-like commands is a task to be implemented by yourself. If you are running your program on a Windows machine and you want to enable users to execute Windows commands, you have advantage, as it is possible to run command prompt commands from .NET. Just start the commands via System.Diagnostics.Process.Start method. For details see this stackoverflow post.

So you just need to write a simple wrapper class that the ShellCommand event handler can call in case one of the custom commands needs execution and then execute it.

...