gs1920-24hpv2 non-interactive ssh `invalid command`
Hi
- when i logged in ssh session and execute `show system-information` - all works fine
- when i execute `ssh admin@192.168.0.254 show system-information` - Received disconnect from 192.168.0.254 port 22:2: invalid command system-information.
Is there any way to make this work?
0
All Replies
-
Hi @R4scal
Zyxel switch currently doesn't support such command to directly ask the info.
It seems to us that your goal is to poll data from devices, our suggestion would be to use SNMP or create a script.
Zyxel_Lucious
0 -
@Zyxel_Lucious Thanks for answer
Any plans to add support of directly ask the info? It's really needed, because snmp doesn't have enough metrics about environment and poe ports
0 -
Hi @R4scal
There is no plan for this feature due to internal concern which involves security breach.
For now, a script SSH is rather recommended for your demand.
Zyxel_Lucious
0 -
Time for forum thread necromancy..I came across this problem, tried many methods to get around it. This one just about works but is unreliable. It looks like the switch might terminate the connection after the command has run but before all the command output has been sent over the SSH session.
echo -e "show interfaces status\nshow version\n" | sshpass -p 'routerpasswordhere' ssh -v admin@router.ip.address.here
Eventually I've found a reliable method is using the linux utility "expect". Here is a very simple example file. Make the file then chmod to +x and then run it. (obviously make sure you've installed expect (e.g. apt install expect).)#!/usr/bin/expect -f set username [lindex $argv 0]; set ip [lindex $argv 1]; spawn ssh $username@$ip expect "password: " send "INSERTPASSHERE\r" expect "# " send "show version\r" expect "# " send "show interfaces status\r" expect "# " send "show mac address-table all\r" expect "# " send "exit\r"
I then call the script using ./switch_info_fetcher techsupport 10.11.12.4I hope the above advice helps someone else searching for the answers.1
Categories
- All Categories
- 414 Beta Program
- 2.3K Nebula
- 132 Nebula Ideas
- 92 Nebula Status and Incidents
- 5.4K Security
- 181 USG FLEX H Series
- 258 Security Ideas
- 1.4K Switch
- 71 Switch Ideas
- 1K Wireless
- 37 Wireless Ideas
- 6.2K Consumer Product
- 236 Service & License
- 372 News and Release
- 79 Security Advisories
- 24 Education Center
- 5 [Campaign] Zyxel Network Detective
- 2.9K FAQ
- 34 Documents
- 34 Nebula Monthly Express
- 80 About Community
- 69 Security Highlight