LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-22-2012, 12:58 PM   #1
rolly4444
Member
 
Registered: Sep 2012
Posts: 39

Rep: Reputation: Disabled
i want a shell script to change the root password for 26 redhat system in on go


i want a shell script to change the password for 26 redhat system in on go
 
Old 09-22-2012, 01:23 PM   #2
sackboy
LQ Newbie
 
Registered: Sep 2012
Posts: 20

Rep: Reputation: Disabled
At your own risk:

http://www.novell.com/coolsolutions/tools/17386.html

I just googled "script to change root password".

Good luck.
 
1 members found this post helpful.
Old 09-22-2012, 04:51 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,990

Rep: Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448
If i am wrong .... ( but i do not think so)
as per the LQ RULES !!!

we will NOT help you "crack" and illegally hack systems

there are IRC's for that

basically

if you HAVE to ask HOW
then you should NOT be even tiring this
 
Old 09-23-2012, 12:29 AM   #4
dsplayer14
Member
 
Registered: Nov 2011
Distribution: Arch Linux and Slackware 13.37
Posts: 127

Rep: Reputation: 1
Quote:
Originally Posted by John VV View Post
if you HAVE to ask HOW
then you should NOT be even tiring this
Indeed.
 
Old 09-23-2012, 01:27 AM   #5
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
Quote:
Originally Posted by dsplayer14 View Post
Indeed.
Here with simple method we can use.

Noet: To reset password in one commad line,the below command will help you

echo new_passwd|passwd root –stdin

(2) Create passwordless RSA key authentication with your all server to Centralised server from where you will execute the script.

For Ref. you can see my blog
http://sharadchhetri.com/2011/11/28/...ordless-login/

(3) after doing RSA authentication with Central Server.Create a bash script and add all ur 23 server name there.

vi reset_root.sh

#!/bin/bash

ssh root@server_name1 "echo new_passwd|passwd root –stdin"
ssh root@server_name2 "echo new_passwd|passwd root –stdin"
ssh root@server_name3 "echo new_passwd|passwd root –stdin"

:wq

#chmod +x reset_root.sh
# ./reset_root.sh


There are other ways also.this one is very simple . If you need some more advanced format,i need some time to create it for you,

(till then you can read expect command also,do google for it)
 
Old 09-25-2012, 06:36 AM   #6
rolly4444
Member
 
Registered: Sep 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Smile thanks sackboy i'll try it

thanks sackboy i'll try it
 
Old 09-25-2012, 06:42 AM   #7
rolly4444
Member
 
Registered: Sep 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by John VV View Post
If i am wrong .... ( but i do not think so)
as per the LQ RULES !!!

we will NOT help you "crack" and illegally hack systems

there are IRC's for that

basically

if you HAVE to ask HOW
then you should NOT be even tiring this


i'll not crack anything, coz i have all the privileges to do any thing in the system
but i need to change the root password every while and i do it manually
but this is so tedious
 
Old 09-25-2012, 07:17 AM   #8
rolly4444
Member
 
Registered: Sep 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sharadchhetri View Post
Here with simple method we can use.

Noet: To reset password in one commad line,the below command will help you

echo new_passwd|passwd root –stdin

(2) Create passwordless RSA key authentication with your all server to Centralised server from where you will execute the script.

For Ref. you can see my blog
http://sharadchhetri.com/2011/11/28/...ordless-login/

(3) after doing RSA authentication with Central Server.Create a bash script and add all ur 23 server name there.

vi reset_root.sh

#!/bin/bash

ssh root@server_name1 "echo new_passwd|passwd root –stdin"
ssh root@server_name2 "echo new_passwd|passwd root –stdin"
ssh root@server_name3 "echo new_passwd|passwd root –stdin"

:wq

#chmod +x reset_root.sh
# ./reset_root.sh


There are other ways also.this one is very simple . If you need some more advanced format,i need some time to create it for you,

(till then you can read expect command also,do google for it)


i'll try it, it seems perfect
but please can you make the expect script coz i found alot of expect scripting on the web but all are confusing
thank u very much
 
Old 09-25-2012, 06:07 PM   #9
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
Quote:
Originally Posted by rolly4444 View Post
i'll try it, it seems perfect
but please can you make the expect script coz i found alot of expect scripting on the web but all are confusing
thank u very much
ok, I wrote it long back ago and modified when I found new version of expect.
u can try with this

http://sharadchhetri.com/2010/12/07/how-to-use-expect-in-bash-script/


Try sshpass package also.
Read once,it will be useful.
http://sharadchhetri.com/2011/12/02/...er-by-sshpass/
 
1 members found this post helpful.
Old 09-26-2012, 05:31 AM   #10
rolly4444
Member
 
Registered: Sep 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sharadchhetri View Post
ok, I wrote it long back ago and modified when I found new version of expect.
u can try with this

http://sharadchhetri.com/2010/12/07/how-to-use-expect-in-bash-script/


Try sshpass package also.
Read once,it will be useful.
http://sharadchhetri.com/2011/12/02/...er-by-sshpass/
very helpful
thank u sharadchhetri
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to change the password of root in redhat 6. pinga123 Linux - Newbie 2 04-02-2012 04:55 AM
[SOLVED] Shell script to change password for current user treznik Linux - General 7 09-12-2010 05:17 PM
Shell script to change password kamal_aitin Linux - General 6 07-25-2007 01:09 AM
asking for root password from within a shell script win32sux Programming 11 08-27-2006 03:42 PM
Can my shell script change the password of user ? prabhatsoni Linux - Software 1 05-27-2006 03:06 AM


All times are GMT -5. The time now is 01:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration