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 [email protected] 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 [email protected]
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
- 178 Beta Program
- 1.7K Nebula
- 88 Nebula Ideas
- 63 Nebula Status and Incidents
- 4.7K Security
- 236 Security Ideas
- 1.1K Switch
- 51 Switch Ideas
- 913 WirelessLAN
- 27 WLAN Ideas
- 5.4K Consumer Product
- 174 Service & License
- 295 News and Release
- 65 Security Advisories
- 14 Education Center
- 978 FAQ
- 424 Nebula FAQ
- 253 Security FAQ
- 100 Switch FAQ
- 115 WirelessLAN FAQ
- 21 Consumer Product FAQ
- 65 Service & License FAQ
- 34 Documents
- 34 Nebula Monthly Express
- 68 About Community
- 52 Security Highlight