LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   password changing in shell scripting (https://www.linuxquestions.org/questions/linux-newbie-8/password-changing-in-shell-scripting-4175542574/)

prasanth.bbnl 05-14-2015 06:11 AM

password changing in shell scripting
 
Hi,

i am using ubuntu 12.04 i working on scripting i want know how to change set of user passwords in shell scripting .

T3RM1NVT0R 05-14-2015 06:30 AM

Welcome to LQ!!!

Would like to mention that we would not write script for you. Let us know what you have prepared so far?

Did you have a look at passwd man page? If you want to set same password for a user let say testuser you can use:

Code:

echo "password" | passwd testuser --stdin
How to use it in script you have to figure out.

If you want to set random password then you might want to have a look at /dev/urandom + tr. The other tools like fold will depend on the number of characters you want in your password.

ondoho 05-14-2015 07:51 AM

Quote:

Originally Posted by T3RM1NVT0R (Post 5362339)
Did you have a look at passwd man page?

just to clarify, open a terminal (Ctrl-Alt-T), type "man passwd".

rtmistler 05-14-2015 08:15 AM

Welcome to LQ. Please post what you have so far for your script.

veerain 05-14-2015 11:40 PM

You may use 'chpasswd' for bulk changing.

jefro 05-15-2015 03:22 PM

Can make scripts with autoexpect in some cases too.


All times are GMT -5. The time now is 07:03 PM.