Home About BC DR HA Support Training Download
You are here: Home/ Downloads/ Scripts/ Expect/ Please Login or Register

-
Current Location
-

js
  Downloads
    Scripts
      Expect
-
AIX Admin Methodology
Global Consolidation Project
All AIX admins should join
www.aixexpert.com


Join our LinkedIn Group
AIX Advanced Technical Experts
Contract Opportunities

www.LinkedIn.com

-
digg Digg this page
del.icio.us Post to del.icio.us
Slashdot Slashdot it!


LPAR Leasing
Lease an AIX / i5 LPAR
Reduce your costs

www.mtxia.com

Server Leasing
Lease a Server off-site
Reduce your costs

www.mtxia.com

Data Center Automation
Business Continuity and DR
Virtualization/Consolidation

www.mtxia.com

HMC Service
Hardware Management Console
Manage Remote AIX / i5 LPARs

www.siteox.com

Business Web Site Hosting
$3.99 / month includes Tools,
Shopping Cart, Site Builder

www.siteox.com

Disaster Recovery
Small Business Oriented
Off-Site Facilities

www.mtxia.com

IBM pSeries / iSeries
Reduce your Costs
Off-Site Server Hosting

www.mtxia.com

Script: change_passwd.exp

#!/usr/bin/expect -f
#
# Author: Chris Narcouzi  cnarcouz [ at ] cswg [ dot ] com
# 
# This script changes the password of a user without being prompted for
# the passord itself. It is used in conjuction with another ksh script
# called change_passwd.sh that provides the UNIX box name, the userid, and
# the root password. This script sets the user's password to "1234" but
# you can change it to anything you like.
# 

proc usage {} {
    send_error "usage: change_passwd  \n"
    exit 1
}

if {[llength $argv] < 2} usage

set hostname [lindex $argv 0]
set userid [lindex $argv 1]
set rootpasswd [lindex $argv 2]
set timeout -1
spawn telnet $hostname
match_max 100000
expect -exact "login: "
send -- "root\r"
expect -exact "root's Password: "
send -- "$rootpasswd\r"
expect -exact "root@$hostname>"
send -- "passwd $userid\r"
expect -exact "New password: "
send -- "1234\r"
expect -exact "new password again:"
send -- "1234\r"
expect -exact "root@$hostname>"
send -- "exit\r"
expect eof


Script: change_passwd.sh

#!/bin/ksh
#
# Author: Chris Narcouzi  cnarcouz [ at ] cswg [ dot ] com
# 
# This script provides input to Expect script called change_passwd.exp.
# The change_passwd.exp script actually telnet to the UNIX box provided
# with the root password provided and change the userid provided password.
# The password for the user is set in change_passwd.exp script.  You can
# modify it in that script. You can tailor this script and use a for loop
# to perform mass password changes.

root_passwd="password"
UNIX="unix-box-name"
userid="userid"

expect -f /your/directory/change_passwd.exp $UNIX $userid $root_passwd

-
Change Password
-
 


LPAR Leasing
Lease an AIX / i5 LPAR
Reduce your costs

www.mtxia.com

Server Leasing
Lease a Server off-site
Reduce your costs

www.mtxia.com

Data Center Automation
Business Continuity and DR
Virtualization/Consolidation

www.mtxia.com

HMC Service
Hardware Management Console
Manage Remote AIX / i5 LPARs

www.siteox.com

Business Web Site Hosting
$3.99 / month includes Tools,
Shopping Cart, Site Builder

www.siteox.com

FREE Domain Registration
included with Web Site Hosting
Tools, Social Networking, Blog

www.siteox.com

Disaster Recovery
Small Business Oriented
Off-Site Facilities

www.mtxia.com

IBM pSeries / iSeries
Reduce your Costs
Off-Site Server Hosting

www.mtxia.com