You mentioned that the "*" in /etc/passwd file led you to believe the
password may have been stored there as plain text. Drop the "in plain
text" and you're very definitely correct - it used to be stored there,
and then got moved into /etc/shadow. I suspect, however, from pretty
early on it was encrypted, even in /etc/passwd.
As for why it got moved - classic "separation of privileges". A lot of
stuff in /etc/passwd is general administrivia. The password, on the
other hand, is very security sensitive. Many programs need to be able to
read passwd - exfiltrate it and you can do an offline dictionary attack
on the password field. If the password itself is in shadow, you can lock
that down so that only root can read it when checking logins. As indeed
you note further down.
Another point - you DO want a dictionary item username, just set its
position to 0. Every field should have a descriptive name, and that
includes the key. Leaving it as just @ID is "programming by obfuscation"
- something a lot of early Pick programs suffered from ...
Which is odd, because when you're processing each line of the passwd
file I think you are being massively verbose :-)
I'd do your "convert ; and ," stuff, then just
USERNAME = LINE<1>
DEL LINE<1>
WRITE LINE TO LINUX.USER.FILE, LINE
along with maybe a comment that the field order in LINUX.USER.FILE is
the same as in passwd. I prefer to write efficient code and use comments
to explain the intent, rather than writing verbose code (or, as I'm
doing a lot of in VBA lately, writing verbose code with comments to
explain why the concise version won't work! :-) :-) )
Cheers,
Wol