Slackware - Installation This forum is for the discussion of installation issues with Slackware. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-20-2016, 12:21 AM
|
#1
|
Member
Registered: Apr 2012
Posts: 65
Rep: 
|
bash script for reset the user and root password
Hi friends,
I need to create a bash script for reset a root password and user password for multiple servers and it doesnt have direct root access in cent os. so can u please help on this.
the process are like this for multiple servers
ssh sas@serverip
su -
passwd
new password
new password
password successfully updated
passwd sas
new password
new password
password successfully updated
exit.
|
|
|
01-20-2016, 07:39 AM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,801
|
Quote:
Originally Posted by mail2ganesh.cse
Hi friends,
I need to create a bash script for reset a root password and user password for multiple servers and it doesnt have direct root access in cent os. so can u please help on this. the process are like this for multiple servers
ssh sas@serverip
su -
passwd
new password
new password
password successfully updated
passwd sas
new password
new password
password successfully updated
exit.
|
As you've been asked MANY times previously, SPELL OUT YOUR WORDS, and STOP USING TEXT SPEAK....read the LQ Rules. And also, read the Question Guidelines Link in my posting signature. We will HELP you, but you, PERSONALLY, need to show some effort of your own. Post the script that you have written, what you've tried, and what message(s)/error(s) you're getting, and we will be happy to help.
Otherwise, we are NOT going to write a script for you. There are many thousands of bash-scripting you can find with a Google search...and since you've been here for four years now, you should know we're not going to write you a script.
|
|
|
01-20-2016, 08:29 AM
|
#3
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
Also, you indicate that this is a script you want to run on existing CentOS servers, so why are you posting in "Slackware - Installation" forum? No-one is going to take you seriously.
|
|
1 members found this post helpful.
|
01-21-2016, 05:32 AM
|
#4
|
Member
Registered: Apr 2012
Posts: 65
Original Poster
Rep: 
|
Hi,
i have written below, and its direct root to change it, but i need to know logging as user(sas) and then need to go root user and change the both user & root password.
ganesh-1684@landing~>cat passwordreset.sh
for server in `cat servers.txt`; do
ssh $server -l sas 'passwd <<EOF
old_pass
new_pass
new_pass
EOF';
done
ganesh-1684@landing~>
|
|
|
01-21-2016, 11:20 AM
|
#5
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,801
|
Quote:
Originally Posted by mail2ganesh.cse
Hi,
i have written below, and its direct root to change it, but i need to know logging as user(sas) and then need to go root user and change the both user & root password.
ganesh-1684@landing~>cat passwordreset.sh
for server in `cat servers.txt`; do
ssh $server -l sas 'passwd <<EOF
old_pass
new_pass
new_pass
EOF';
done
ganesh-1684@landing~>
|
Ok, so either use "su - root" or "sudo <command>". And this script is horribly insecure...changing the root password should NEVER be trivial. Anyone who can even FIND this script on your server, can then change the root passwords on ALL your servers, and do whatever they please. Or (worse), just SEE the password (since you're keeping it in clear text), log in as root, and lock EVERYONE out.
|
|
|
All times are GMT -5. The time now is 10:39 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|