Popular Posts

Saturday, June 7, 2014

How to change password via script

Hello Guyz, we all know that we can change password using 'passwd $USER' command (must be root for changing password of any user )

this is most common way but if you want to change password using script then ?

Dont worry I have a solution for this :)

just enter below line in your script ( password is something that you should not store in plain file/script as it but you can use any encryption technique or something like that..its upto you )


echo -e "new_pwd\nnew_pwd" | (passwd --stdin $USER_NAME)
 
 
 
 
 

No comments:

Post a Comment