On Sat, Sep 16, 2017 at 11:20:11AM +0200, Emmanuel Kasper wrote: >or at least a chroot environment > >I wrote a fai script to set the root passwords of the vagrant boxes. >There are multiple ways of doing this but I settled to use: > >echo root:vagrant | chpasswd > >now as this should happen in the FAI install chroot I initially wrote: > >$ROOTCMD echo root:vagrant | chpasswd >where $ROOTCMD is interpolated to chroot /tmp/fai-tmp-build > >and it changed the root password of my *build* host. >See the mistake ?
Oops... :-) >Things before the pipe are interpreted by the shell as a single command >construct, so /bin/echo was running inside the chroot, but chpasswd was >running outside the chroot. > >The proper fix was of course to write: >echo root:vagrant | $ROOTCMD chpasswd ACK! -- Steve McIntyre, Cambridge, UK. [email protected] "I can't ever sleep on planes ... call it irrational if you like, but I'm afraid I'll miss my stop" -- Vivek Das Mohapatra
