Moving from a FreeBSD server to Ubuntu. I copied the /etc/passwd file across with no problems, but hand-copying one of the hashes from /etc/master.passwd (FreeBSD) to /etc/shadow (Linux) didn't seem to work. The hashes certainly seem to be in the same format, but no joy.

Is this possible to do? Did I make a mistake, or is there something I missed?

Edit: I tried again, and hand-copying seems to have worked. I must've made a typo the first time around.

  • I would suggest that you take a look at LDAP, because it will be using a more elegant authentication imho. moreover take a look at How to Ask
    – djdomi
    Commented Jul 19, 2023 at 17:07
  • You may be right, but it's a small legacy system with only about 50 users, so I'm not sure it's worth the effort. Besides, my goal here is to not make them all do password resets, so switching to LDAP wouldn't help anyway. Commented Jul 19, 2023 at 18:47
  • Traditionally the start of the "hash" defines the hash type. Here's a wikipedia entry about it: en.wikipedia.org/wiki/…
    – A.B
    Commented Jul 19, 2023 at 19:04
  • Yes. On the FreeBSD system, my hashed password started with $6$ while on the Ubuntu system I saw both $6$ and $y$. See my edit above. Commented Jul 20, 2023 at 3:17

1 Answer 1


Experimenting shows that both systems use the same format and algorithms for hashes, so you can cut-n-paste the hash field from /etc/master.passwd to /etc/shadow and it works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .