我想在fortinet防火墙中执行三个命令,这些命令是:
#To enter in the config mode:
config vdom
#To select the virtual domain:
edit "name"
#To see the info I want:
get router info routing-table static但我需要远程操作,为了做到这一点,我尝试了一下:
ssh xx@xx "config vdom; edit "xxx"; get router info routing-table static"当我这样做时,它只执行命令1,并在第二个和第三个中给出一个错误。
我尝试将命令更改为类似的命令,然后执行1和2,但不执行第三个:
ssh xx@xx "config vdom edit "xxxx"; get router info routing-table static"我也试过第三种,但不管用.
看起来它独立地执行命令,而不是按顺序执行。
有办法在一个命令中做到这一点吗?
发布于 2022-02-01 14:31:39
我是通过在python脚本中使用paramiko来做到这一点的。
要在exec_command中引入的命令是:
command = "config vdom\nedit %s\nget router info routing-table static" % (vdom)https://serverfault.com/questions/1092032
复制相似问题