Karaf Console - no connection via SSH running as Windows Service

Dear Team,

i have the issue that i cannot connect via ssh to karaf Console when running openHAB as Windows Service.
I needed to change the port to another value as 8101 was already used and also changed the binding in org.apache.karaf.shell.cfg
See here:

#
# Via sshPort and sshHost you define the address you can login into Karaf.
#
sshPort = 8213
sshHost = 0.0.0.0

Log throws no errors, netstat -a also shows a listener on port 8213 and i can connect to the port via PuTTY, but the connection times out before i even get a username prompt.

I already tried to change the keylength to 1024 as discussed here:

Still - no success.

Any idea what i’m doing wrong?

Thank you for your feedback!

Best regards,
Klaas.

Hi Team,

anyone as any ideas here?

Best regards,
Klaasl

Running as openhab (and karaf) as service implies some changes in how environment variables are passed. The main point is to propagate KARAF_HOME and other variables which are used to compute paths for reading (or rather polling) directories for configurations. If you could upload your service wrapper config I could take a look and suggest possible fixes.

Kind regards,
Lukasz

Hi @splatch,

Took me some time, but here is my wrapper.conf:

https://pastebin.com/w8Rg1169

Let me know if you have any suggestions!

Thanks very much for your support!

Best regards,
Klaas.

Hey Klaas,
This file looks like two files merged into one. You can find there duplicated entries with same parameters. You can easily remove (or comment with # character) everything from beginning to below section:

#*******************************************************
# openHAB2-wrapper.conf for Windows Service Installation
#*******************************************************

I’m not sure if it will help, but it should definitely clean up a little bit startup parameters. What is switching on or off remote shell is wrapper.java.additional.7=-Dkaraf.startRemoteShell=true parameter. You can also check wrapper.log (based on your configuration I would expect it in C:\openhab20\userdata\logs\wrapper.log). If you find there any errors which are not obvious - please post contents. In general - when you run OH2 manually it will be conflicted with windows service as long as you do not change default port numbers.

Good luck
Ɓukasz

1 Like

Hi @splatch,

thanks for your insights! At least it helped me to solve my timezone problem which i had as well.
Times are right now, but the SSH connection still times out.

I needed to change the default port of the SSH Shell as it conflicted with some other Windows Services i use, but i did so in org.apache.karaf.shell.cfg - see here: https://pastebin.com/iJuELkAz

Still, when i start PuTTY and connect to my openHAB IP on the designated port (8123), then the session times out.
Nevertheless i see that there is a process listening on port 8123 on my server, so the SSH is started, but i cannot connect apparently.

Any other idea?
Feedback will be really appreciated.

Best regards,
Klaas.

Your config looks fine. If you see something listening at this port it means that configuration is read properly. You do listen on all interfaces and this might interfere with windows firewall (you need to grant Java access to network). Please try to log in using localhost:8123 and remote-ip:8123 in order to check if it’s a case. With regular ssh client from linux you can enable verbose output to trace connection negotiation, I am not sure if putty allows same thing. If putty times out without showing even a prompt to enter user name it means that link itself is broken. You can use Windows’s sysinternals which offers more detailed output of diagnostic information such process tree, socket usage to trace if Java actually opens socket.

1 Like

OK - Solved as well - thanks @splatch!

It really WAS the firewall
 Classic case of not seeing the forrest for the trees.
Call me a noob.

Thanks again for the help - case closed.

Alles klar! :slight_smile: