Ssh remote execute invalid command

Hi All,

i have setup my public key in vyos and verified i can connect no problems without a password and run commands no problem

but whenever i try to run a command remotely, im getting Invalid command and im not sure why?

PS C:\Users\sas_2\Documents\Developer\talos> ssh vyos@217.123.123.123 “show ip bgp”
Invalid command: [show]

PS C:\Users\sas_2\Documents\Developer\talos> ssh vyos@217.123.123.123
Welcome to VyOS!

Check out project news at https://blog.vyos.io
and feel free to report bugs at https://vyos.dev

You can change this banner using “set system login banner post-login” command.

VyOS is a free software distribution that includes multiple components,
you can check individual component licenses under /usr/share/doc/*/copyright
Last login: Mon Jul 3 11:20:04 2023 from 192.168.251.169

vyos@vyos:~$ show ip bgp
BGP table version is 77, local router ID is 192.168.251.254, vrf id 0
Default local pref 100, local AS 65000
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop’s vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network          Next Hop            Metric LocPrf Weight Path

*>i192.168.251.251/32
192.168.251.101 100 0 i
*=i 192.168.251.102 100 0 i
*=i 192.168.251.103 100 0 i
*>i217.123.123.124/32 192.168.251.104 100 0 i
*=i 192.168.251.105 100 0 i
*=i 192.168.251.106 100 0 i
*>i217.123.123.125/32 192.168.251.106 100 0 i

Displayed 3 routes and 7 total paths
vyos@vyos:~$

You should use /opt/vyatta/bin/vyatta-op-cmd-wrapper

$ ssh vyos@192.168.122.14 /opt/vyatta/bin/vyatta-op-cmd-wrapper show interfaces
Warning: Permanently added '192.168.122.14' (ED25519) to the list of known hosts.
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface        IP Address                        S/L  Description
---------        ----------                        ---  -----------
eth0             192.168.122.14/24                 u/u  WAN
eth1             192.0.2.2/24                      u/u  
eth2             -                                 u/u  
eth3             -                                 u/u  

2 Likes

legend! thank you!

the docs show a completely different way of doing things but didnt work either
where are the docs, can i submit a PR to update it?
https://docs.vyos.io/en/latest/automation/command-scripting.html#run-commands-remotely

1 Like

Hi @si458,

on the top right there is an „Edit on GitHub“ button. Just use it to help improve our documentation. Thanks!

Yeh found it yday sorry meant to say, the pr got rejected cuz it’s an old function