Execute remote command on SSH or telnet

Dear colleagues,

I am running OpenHAB version 4 in a Docker environment and need to connect to an older device that has SSH and Telnet ports open. Occasionally, I need to execute commands via SSH or Telnet on this device.

I found some older forum discussions suggesting different approaches:
• Some recommend executing SSH commands directly via the command line.
• Others mention the existence of a Denon binding that allows sending Telnet commands.

However, these discussions are quite outdated, and some bindings (like TCP) no longer seem to be available in OpenHAB 4.

Additionally, since I am running OpenHAB in a Docker container, SSH and Telnet are not natively installed. Ideally, I’d prefer a binding that offers this functionality rather than modifying the container manually.

What would be the best way to achieve this in OpenHAB 4? Is there a recommended binding or workaround?

Looking forward to your suggestions.

Thanks a lot!
/Franz

There are many ways to do ssh. I have never looked into telnet but if Denon binding supported it, it probably still does.

For docker, you can install ssh by mounting cont-init.d into your docker, and adding a script to install ssh. I do this on mine. I’ve just posted instructions to do it here: Script connect via ssh and run command - #16 by jimtng

Another way is to use jruby and install a ruby native ssh client. It’s not hard to do, but I’d say installing a standard ssh client mentioned above is the “easiest”, especially if you aren’t already using jruby for other things.

1 Like

The SmarthomeJ marketplace has a TCP/UDP binding: GitHub - smarthomej/addons: SmartHome/J addons for openHAB

If your device is a Denon device, that would probably be the easiest thing to do. There are two Denon bindings:

If you go down the path of using ssh or tenet, @jimtng’s reply has everything you need to get that working.

1 Like

Thanks friends

As I really just need an ssh or Telnet connection with nothing else (no Denon device) I guess I’ll use the ssh command option. As Itjink it might be the most long term compatible one.

Thank you
/Franz

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.