On 5 January 2016 at 15:29, Rob Seastrom <[email protected]> wrote:
> "Because reasons" (as the kids say these days) [1], I find myself in a
> situation where I want to extract /etc/passwd lines including the hashes, so
> as to be able to automatically install them in a regenerated VM later.
>
> Basically, what I want to do is pwconv(1), only backwards.
>
> Before I take the time to write this myself, has anyone else got a pointer to
> something that does this?
You could try something like:
sort /etc/passwd > passwd.in
sort /etc/shadow > shadow.in
join -t : -j 1 -o 0,2.2,1.3,1.4,1.5,1.6,1.7 \
passwd.in shadow.in > merged
This does not preserve the subsequent fields of shadow(4), though. I
would be inclined to just keep a copy of the interesting lines from
"passwd" and "shadow" in separate files.
Cheers.
--
Joshua M. Clulow
UNIX Admin/Developer
http://blog.sysmgr.org
-------------------------------------------
smartos-discuss
Archives: https://www.listbox.com/member/archive/184463/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00
Modify Your Subscription:
https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb
Powered by Listbox: http://www.listbox.com