We’ve got some ancient ftp and sftp servers which we need to retire. Wondering how/if we could grab accounts (/etc/passwd + /etc/shadow) from old server and populate to new.
Old #1 RHEL 4.5
Old #2 Ubuntu 12 LTS
New RHEL 7.x
I’m a newbie ansible user and wondering what some of you knowledgeable users might think.
the 'getent' module will get you that information, as database options
use 'passwd' to get most user information and 'shadow' to get the
password hashes (this last one requires root permissions)
If the accounts do not overlap with existing account names or UIDs, you can literally just append the old files to the current ones. BTW, you need to check group names and GIDs too (/etc/groups). You could perhaps save some time by just identifying conflicts; maybe there are few enough to make this approach workable.
If there are too many conflicts you could also take those files and add something to each name and group name, to uniquify them. Then move the UIDs and GIDs into a numeric region that is not in use on the new servers. Then do the append. Passwords would remain the same, and the change to the username could be easily communicated to the users (“Your username is now the same as it was, but with ‘x’ at the end. So if your username was ‘fred’, it is now ‘fredx’”).
This would only handle users’ primary groups. You would have to also add them to suitable existing groups like “users”, “staff”, whatever.
This is all very automatable, but would take a while to do from scratch. I’d be looking for an existing product. Oh wait - that’s what you WERE doing!