Automate SSH Login to CISCO Device with Expect

Step 1: Install expect (Centos 6.7 32bit)
yum install expect

Step 2: Verify expect install correct
expect –v

Step 3: Create Working Folder for Script
cd $HOME
mkdir CiscoAutomation
cd CiscoAutomation

Step 4: Create expect script with vi
vi TestCISCOLogin.exp

รจScript file contents
set timeout 10
set hostname [lindex $argv 0]

set username "username"
set password "password"
set enablepassword "password"

spawn ssh $username@$hostname

expect "Password:" {
  send "$password\n"

  expect ">" {
    send "en\n"
    expect "Password:"
    send "$enablepassword\n"



Popular posts from this blog

Basic Send Message to MQ with Java and IBM MQ JMS

Basic Receive Message to MQ with Java and IBM MQ JMS

Creating a simple Alert / Success Message with ASP.NET/VB using Bootstrap