scripting a root password change

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,901
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.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,901
Location
USA
We need a default password for appliances when they are shipped. The user will have to change it after it boots.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,901
Location
USA
Thanks for the help, but I found a much simpler solution from a coworker:

Code:
echo changeme | passwd --stdin root
 
Top