1 Replies - 314 Views - Last Post: 06 September 2017 - 04:42 AM

#1 mercy_angel  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 330
  • Joined: 28-February 13

put a command into router through sshpass bash script

Posted 06 September 2017 - 01:22 AM

hello, i am facing some issue. I am using a simple bash script that via sshpass put a command into router. Now, problem is that i have a file and commands into it.

sshpass -p $pass ssh -o $log -n $[email protected]$h /ip address set [/ip address find address="10.0.0.2/24"] address=10.0.0.1/24 


So command /ip and so on is command to my router. I am having an file that have all commands, like a backup.
How can I put it all and not paste into that line after sshpass..?

Is This A Good Question/Topic? 0
  • +

Replies To: put a command into router through sshpass bash script

#2 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6559
  • View blog
  • Posts: 30,699
  • Joined: 10-May 07

Re: put a command into router through sshpass bash script

Posted 06 September 2017 - 04:42 AM

You can issue commands just with ssh :

Quote

$ ssh [user]@[host] uptime
[user]@[host]'s password:
07:41:31 up 15 days, 20:05, 0 users, load average: 0.05, 0.01, 0.00
$ uptime
7:41 up 25 days, 19:09, 6 users, load averages: 2.38 2.18 2.19


Also, if you want to set the ipaddress, why not use ifconfig?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1