0

I have a script, which is installing a guest machine on a xen server.

It installs automatically. But in one step, I'll be asked for a password.

The following happens:

Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error

How can I send the password "1234" at this time? Maybe with expect and send?

Here is the command, which executes passwd:

chroot /mnt/vms/install /usr/bin/passwd root

It's an internal server, so it must not be very secure.

Vince
  • 1,133
  • 3
  • 17
  • 34

1 Answers1

0

I have used "chpasswd" command in script, after useradd, to do that. For example

useradd -m -s /bin/bash -u 1001 -g 1003 -G sudo newuser || exit 1
echo newuser:newuserpassword | chpasswd || exit 1

Refer to debianadmin or man page.

Joe Kul
  • 2,454
  • 16
  • 16