0

I would like to execute three commands in a fortinet firewall, the commands are:

#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 

But I need to do it remotely, to do that, I try this:

ssh xx@xx "config vdom; edit "xxx"; get router info routing-table static" 

When I do that, it executes only the command 1 and gives an error in the second and the third.

I tried changing the command to something like this and it executes 1 and 2, but not the third:

ssh xx@xx "config vdom edit "xxxx"; get router info routing-table static" 

And I tried the same for the third one but it does not work...

Looks like it executes the commands independently and not in a sequence.

Is there a way to do that in a single command?

1 Answer 1

1

I did it by using paramiko in a python script.

The command to introduce in the exec_command is this one:

command = "config vdom\nedit %s\nget router info routing-table static" % (vdom) 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.