LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   i want a shell script to change the root password for 26 redhat system in on go (https://www.linuxquestions.org/questions/linux-newbie-8/i-want-a-shell-script-to-change-the-root-password-for-26-redhat-system-in-on-go-4175428546/)

rolly4444 09-22-2012 11:58 AM

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

sackboy 09-22-2012 12:23 PM

At your own risk:

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

I just googled "script to change root password".

Good luck.

John VV 09-22-2012 03:51 PM

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

dsplayer14 09-22-2012 11:29 PM

Quote:

Originally Posted by John VV (Post 4786742)
if you HAVE to ask HOW
then you should NOT be even tiring this

Indeed.

sharadchhetri 09-23-2012 12:27 AM

Quote:

Originally Posted by dsplayer14 (Post 4786895)
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)

rolly4444 09-25-2012 05:36 AM

thanks sackboy i'll try it
 
thanks sackboy i'll try it

rolly4444 09-25-2012 05:42 AM

Quote:

Originally Posted by John VV (Post 4786742)
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

rolly4444 09-25-2012 06:17 AM

Quote:

Originally Posted by sharadchhetri (Post 4786904)
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

sharadchhetri 09-25-2012 05:07 PM

Quote:

Originally Posted by rolly4444 (Post 4788762)
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/

rolly4444 09-26-2012 04:31 AM

Quote:

Originally Posted by sharadchhetri (Post 4789234)
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


All times are GMT -5. The time now is 03:39 AM.