1

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.

Edward Falk
  • 141
  • 7
  • 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 [ask] – djdomi Jul 19 '23 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. – Edward Falk Jul 19 '23 at 18:47
  • Traditionally the start of the "hash" defines the hash type. Here's a wikipedia entry about it: https://en.wikipedia.org/wiki/Crypt_(C)#Key_derivation_functions_supported_by_crypt – A.B Jul 19 '23 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. – Edward Falk Jul 20 '23 at 03:17

1 Answers1

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.

Edward Falk
  • 141
  • 7