Python Forum
SSH to a device using paramiko fails
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SSH to a device using paramiko fails
#1
Hi All Smile
My requirement is to simply ssh to a router using python paramiko

So I being new to python wrote this simple script but nothing happens when I run it.
But I CAN connect using this command in Ubuntu
admin1ubu@ubuntu01:~$ ssh -l user1 192.168.100.1
Password:

R1>


Here is the code that wrote

#!/usr/bin/env python
import paramiko
import time

session = paramiko.SSHClient()
session.set_missing_host_key_policy(paramiko.AutoAddPolicy())
session.connect("192.168.100.1",port=22, username = "user1",password = "pass1")
connection = session.invoke_shell()
connection.send("terminal length 0\n")
time.sleep(1)

connection.send("\n")
connection.send("configure terminal\n")
time.sleep(1)
Not even an error is given when I run this script
Please let me know what I am doing wrong
Thanks!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Connect to device without paramiko/netmiko modules kang18 3 3,000 Jun-05-2020, 10:54 AM
Last Post: Larz60+
  Copy data from 1 blk device in machine A to another blk device in machine B AbhishekV 2 3,398 Feb-01-2018, 11:40 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020