Script commands via SSH – Sonicwall

I had the need to script some configuration in our Sonicwall firewall, so I went looking for a way to do this. I found a solution to configure via SSH here, but I needed to add some additional switches to make it work. Here is an example that does work.

(echo -e 'admin\npassword'; sleep 2; echo 'show interface X2'; sleep 2; echo logout; sleep 2) | ssh -t -t admin@X.X.X.X

Update: I recently tried using this again, and found that it didn’t quite work. I had to change it to the following:

(echo -e 'admin'; sleep 2; echo 'npassword'; sleep 2; echo 'show interface X2'; sleep 2; echo logout; sleep 2) | ssh -t -t admin@X.X.X.X
Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: