gs1920-24hpv2 non-interactive ssh `invalid command`
Options
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?
All Replies
-
-
@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
-
-
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.
Categories
- All Categories
- 442 Beta Program
- 3.1K Nebula
- 245 Nebula Ideas
- 6.9K Security
- 815 USG FLEX H Series
- 394 Security Ideas
- Threat Watch!
- 1.8K Switch
- 88 Switch Ideas
- 1.5K Wireless
- 60 Wireless Ideas
- 7.3K Consumer Product
- 334 Service & License
- 543 News and Release
- 107 Security Advisories
- 31 Education Center
- 10 [Campaign] Zyxel Network Detective
- 5.7K FAQ
- 34 Documents
- 89 About Community
- 125 Security Highlight
Freshman Member
Zyxel Employee