Zyxel XS1930-12HP SSH command over libssh (C++)

Options
Chris77
Chris77 Posts: 10  Freshman Member
First Anniversary Friend Collector
edited August 2022 in Switch
Hi,

I am trying to run the SSH command "show pwr" in my program (C++) via SSH connection. I use the libssh for this. I can see in the system log of the switch that the connection works:

"IN authentication: SSH user admin login [IP address = 192.168.0.172]".

When I send the command "show pwr" I receive the "unknown error" (-1). In system log unfortunately nothing is shown here.
If I use a different product instead of Zyxel, everything works fine.
Does anyone have an idea what the problem could be?

All Replies

  • Zyxel_Melen
    Zyxel_Melen Posts: 1,639  Zyxel Employee
    First Anniversary 10 Comments Friend Collector First Answer
    Options
    Hi @Chris77,

    May I know you got the error message when you run your program? Or have you try to SSH to XS1930-12HP and enter the command and get same error message?

    Zyxel Melen

  • Chris77
    Chris77 Posts: 10  Freshman Member
    First Anniversary Friend Collector
    Options
    Hi @Melen,

    in my program, when I send a command, I get an unknown error from the libssh. This only happens with a Zyxel switch. Other switches work fine.
    If I start a session via PuTTY and send the command, everything works.
  • Zyxel_Melen
    Zyxel_Melen Posts: 1,639  Zyxel Employee
    First Anniversary 10 Comments Friend Collector First Answer
    Options
    Hi @Chris77

    Based on your test result, using PuTTY is working fine. And we also tried Tera term and local SSH via Windows command line, they all work well with ZYXEL switch.
    Not sure what Libssh did to cause the difference. Since the error is returned by Libssh, maybe they could explain why it happens.

    Zyxel Melen

  • Chris77
    Chris77 Posts: 10  Freshman Member
    First Anniversary Friend Collector
    edited June 2022
    Options
    Zyxel_Melen,

    The libssh I use runs fine. Several projects run without problems. The problem must be something else. I suspect that the switch only supports "interactive" ssh sessions. If I enter the following command in git-bash:

    ssh admin@192.168.0.10 show pwr
    or
    ssh admin@192.168.0.10 "show pwr"

    I get the following message from the switch:

    "Received disconnect from 192.168.0.10 port 22:2: invalid command pwr."

    To me it looks like the switch does not support the direct commands.

    I found the same problem here in forum:

    Post 1
    Post 2

    Many greetings
    Chris
  • Zyxel_Melen
    Zyxel_Melen Posts: 1,639  Zyxel Employee
    First Anniversary 10 Comments Friend Collector First Answer
    edited June 2022
    Options
    Hi @Chris77

    Zyxel switch currently not support this function.
    We suggest you not to use one line command and build your program step by step.
    You can reference this post to build your program. 
    We also have an idea post which is suggested by other user, I will help to leave your comment there.

    Zyxel Melen