passwd

Harald Becker ralda at gmx.de
Mon May 9 17:23:26 UTC 2011


 Hallo Sergey!

> May be you know how to forge /etc/passwd file for embedded system? I
> can't execute target passwd (also adduser etc.) on the host machine
> and host's version can only write into /etc/passwd. Is there more
> reliable and elegant way than to make a backup of current files, forge
> new ones and then restore originals (so how to force passwd and
> company to use another file to deal with)?

I know no way to let passwd use another file ...

... but it is really easy to do modifications to the passwd file using
sed calls as this file and corresponding (shadow, group, gshadow) are
simple text files. Busybox in addition has the cryptpw or makepw applets
to encode a password. So you just need to do a cryptpw call to get the
encrypted password and use sed to change either your passwd or shadow
file. That sed call can change every file you like ... :-)

--
Harald


More information about the busybox mailing list