Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save elcontrastador/76f22b9d41d0716ba742e558d1670541 to your computer and use it in GitHub Desktop.
Save elcontrastador/76f22b9d41d0716ba742e558d1670541 to your computer and use it in GitHub Desktop.
## Problem: Basically the switch authenticates but doesn't actually put me in edit mode...the error I get with the subsequent 'show' command is the output from typing 'show' in view (non-edit) mode. Thoughts?
### bin/swcut.rb
require 'net/ssh'
Net::SSH.start('172.22.142.1','myuser', password: 'mypass') do |ssh|
ssh.exec!('edit')
puts ssh.exec!('show')
end
### output start ###
Tylers-MacBook-Pro-3:voip tyler$ ruby bin/swcut.rb
error: syntax error, expecting <command>: show
Tylers-MacBook-Pro-3:voip tyler$
### output end ###
### from ssh interactive ###
> ssh myuser@172.22.142.1
myuser@172.22.142.1's password: <mypass>
--- JUNOS 12.3R12.4 built 2016-01-20 04:27:28 UTC
{master:0}
oneif@dist1.tr200.hh> <type 'edit'>
Entering configuration mode
Users currently editing the configuration:
oneif terminal p3 (pid 99909) on since 2017-08-12 15:07:06 GMT+8, idle 01:06:56
{master:0}[edit system services dhcp]
{master:0}[edit]
oneif@dist1.tr200.hh# <type 'show'>
## Last changed: 2017-08-12 15:50:43 GMT+8
version 12.3R12.4;
system {
host-name dist1.tr200.hh;
time-zone GMT+8;
root-authentication {
.
.
. lots...
### end from ssh interactive ###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment