LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need script to change server password (https://www.linuxquestions.org/questions/linux-newbie-8/need-script-to-change-server-password-939535/)

durgeshyadav 04-12-2012 05:28 PM

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

suicidaleggroll 04-12-2012 05:34 PM

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.

Tinkster 04-12-2012 05:41 PM

Hi, welcome to LQ!

Quote:

Originally Posted by durgeshyadav (Post 4651363)
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

chrism01 04-12-2012 05:45 PM

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/


All times are GMT -5. The time now is 02:34 PM.