[j-nsp] Running shell commands from ssh.

Kevin de Kok kevin at oom-killer.org
Fri Mar 17 12:24:06 EST 2006


Vladimir S. Blazhkun wrote:
>> Hi y'all,
>>
>> I seem to remember having seen a way to do this, but cannot find it
>> anymore (checked the list, Juniper-clue, etc) -- I need to run some
>> shell commands from a non-interactive ssh.
>>
>> I have tried various permutations of ssh <router> "start shell; ls;
>> exit; exit" and similar things, but no luck. It seem that the
>> commands that are passed in do not get handed to the shell....
>>
>> And no, I don;t want to create another user (or change an existing
>> user) to have a shell of something other than "/usr/sbin/cli"
>>
>> Warren.
>>     
>
> Write a simple script using expect/tcl/tk for this.
>
> #!/usr/bin/expect --
> set ssh "/usr/bin/ssh"
> set timeout 30
> spawn $ssh <router>
> sleep 5
> send "start shell\n"
>
> and so on...
>
>   
Hi there,

I have created some simple management scripts for linux. You can use it 
on your linux machine with ssh keys. You can grab the scripts here; 
http://www.oom-killer.org/jbin/ you can just add or remove simple bgp 
peers and some policies. I wont support my scripts though it aint that 
hard to understand how it works. I hope i helped you with this.

Kevin.


More information about the juniper-nsp mailing list