Change passwd for bulk servers using SSH script | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Change passwd for bulk servers using SSH script

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-17-2010
vickyingle5 vickyingle5 is offline
Registered User
 
Join Date: Mar 2010
Last Activity: 17 May 2010, 8:22 AM EDT
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Change passwd for bulk servers using SSH script

Hi,

I need to Change passwd for bulk servers using SSH script.

I have one server, from which i can reach all the servers without password via SSH.

There is some expect script, from which i can achieve it.

Can any one help me out here.

Thanks in advance.
Vicky
Sponsored Links
    #2  
Old 05-17-2010
Reboot's Avatar
Reboot Reboot is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 12 July 2012, 4:30 AM EDT
Location: meri jaan Mumbai, from mera desh BHAARAT.
Posts: 147
Thanks: 7
Thanked 15 Times in 15 Posts
Modify following as per your requirements (include ssh) :


Code:
#!/usr/local/bin/expect -f
# Password change shell script, tested on Linux and FreeBSD
# ----------------------------------
# It need expect tool. If you are using Linux use following command
# to install expect
# apt-get install expect
# FreeBSD user can use ports or following command:
# pkg_add -r -v expect
# ----------------------------------
# If you are using linux change first line
# From:
#!/usr/local/bin/expect -f
# To:
#!/usr/bin/expect -f
# -----------------------------------------------
# Copyright (c) 2006 nixCraft project
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# display usage
if {$argc!=2} {
   send_user "usage: $argv0 username password \n"
   exit
}
# script must be run by root user
set whoami [exec id -u]
if {$whoami!=0} {
   send_user "You must be a root user to run this script\n"
   exit
}
#
set timeout -1
match_max 100000
# stopre password
set password [lindex $argv 1]
# username
set user [lindex $argv 0]
# opem shell
spawn $env(SHELL)
# send passwd command
send -- "passwd $user\r"
expect "assword:"
send "$password\r"
expect  "assword:"
send "$password\r"
send "\r"
expect eof

Also just try to serch in google, you will get a lot materials...
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script:Change password on 1000+ servers ak835 Shell Programming and Scripting 1 03-24-2010 07:53 AM
ksh script to change passwd solaix14 Shell Programming and Scripting 1 03-19-2009 07:10 PM
script to change passwords for the same user on multiple servers stolz Shell Programming and Scripting 7 02-17-2009 02:49 PM
change passwd remotely in solaris 10 pharos467 UNIX for Advanced & Expert Users 1 09-15-2008 10:58 AM
Need to change root passwd mayewil UNIX for Dummies Questions & Answers 4 10-27-2006 06:03 PM



All times are GMT -4. The time now is 03:05 AM.