scripting a root password change

Handruin

Administrator
Joined
Jan 13, 2002
Messages
14,041
Location
USA
Anyone have any thoughts for a way to automate a one-time change to make a user account (specifically root) to a specified password? I know the "passwd" command, but I can't get it to enter the password twice into the command. A crude way (or thought) is to copy the shadow file over, but I don't know if that will work.

I'm building a virtual appliance and I need a way to script it so that it can be set to a password of my choosing the first time the Linux system is booted.
 
We need a default password for appliances when they are shipped. The user will have to change it after it boots.
 
Thanks for the help, but I found a much simpler solution from a coworker:

Code:
echo changeme | passwd --stdin root
 
Back
Top