LinuxQuestions.org
Help answer threads with 0 replies.
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 04-12-2012, 06:28 PM   #1
durgeshyadav
LQ Newbie
 
Registered: Apr 2012
Posts: 1

Rep: Reputation: Disabled
Thumbs up Need script to change server password


Hi,

I need shell scrip to change server password on daily basis which will notify me by email. Please help me...


Durgesh

Last edited by durgeshyadav; 04-12-2012 at 06:31 PM.
 
Old 04-12-2012, 06:34 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
What do you have so far?

I would probably use the $RANDOM functionality in bash to generate a series of random numbers, and convert these to valid ascii characters, ultimately generating a string of random ascii N characters long. Then you can use passwd along with expect to set the password, and finally a command line mail program to send it to you.

I would highly recommend writing out the password in an encrypted file for safe keeping though. If the network goes down or email service goes down, you'll lose access to the machine until it's back up, assuming the script keeps on working.

Last edited by suicidaleggroll; 04-12-2012 at 06:37 PM.
 
Old 04-12-2012, 06:41 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Hi, welcome to LQ!

Quote:
Originally Posted by durgeshyadav View Post
Hi,

I need shell scrip to change server password on daily basis which will notify me by email. Please help me...


Durgesh
And on top off the suggestion above I'd like to ask what the rationale of this
exercise is ... what are you trying to achieve? Apart from the obvious, of course.


Cheers,
Tink
 
Old 04-12-2012, 06:45 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Sounds a bit like homework; a new passwd every day is unusual, even in secure establishments.
Note also that email is sent plaintext (!).
If you really want that sort of security, consider ssh+auth-keys and/or use RSA Token.

PS: creating passwds: http://www.cyberciti.biz/faq/generat...ndom-password/
 
  


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
script to change samba users password saifurab Programming 1 02-05-2010 01:59 AM
expect script to change user password sherimm Linux - Software 1 03-13-2009 06:36 AM
Script to change password in initially set as *LK* RaelOM Programming 5 08-13-2008 04:25 PM
Shell script to change password kamal_aitin Linux - General 6 07-25-2007 01:09 AM
Password Change Script krpotdar Linux - General 6 04-17-2002 04:04 PM


All times are GMT -5. The time now is 12:59 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