I'm migrating users from an old server to a new one. It's only a few users, we want to migrate only the active ones and reorganize groups in the process, so I'm doing it manually. One problem remains: How can I migrate their passwords to the new server? Is there a better way than copying password hashes from /etc/shadow by hand?
Asked
Active
Viewed 1.8k times
3
Petr
- 3,273
3 Answers
4
Since there are few enough accounts for you to migrate manually I think lifting the hashes by hand is the way to go. That's how I'd do it atleast.
azzid
- 531
2
Well, you wouldn't need to do it by hand. Just use lastlog to get the list of users who have logged on at least once in, for example, the past year and then grep them in /etc/shadow:
lastlog -t 365 | gawk '{print $1}' | tail -n +2 | while read n; do \
grep -w $n /etc/shadow; done
You could also automate the user creation on the new server as described in my answer here.