This is unexpected and non standard. Each username should have exactly one entry in
/etc/passwd and no more than one entry in
Remediation should be handled with care. For starters I'd get a root shell up and running, and I wouldn't log out of it until I was sure I could safely log in after my editing. Second, I'd take a copy of both files (and note permissions and ownerships) in case I had to revert.
Then I'd use something like
sort -u /etc/passwd and check visually to see if that resolved the duplication. Same for
If not, I'd take an account for which I knew the login details, and I'd discard the second of each duplicate. For both files. Trying to login, if it worked I'd apply the same logic to all entries in both files.
Otherwise I'd need to see some concrete example entries.
Basically, you will need to fix the problem by visual inspection.