chsh corrupts /etc/pwd.db
Alan Somers
asomers at freebsd.org
Wed Aug 21 21:56:07 UTC 2019
Today I tried to use chsh to change my shell from bash to fish. The
command completed successfully, but new logins continued to use bash!
Investigating, I discovered that /etc/pwd.db and /etc/spwd.db seem to
contain 3-4 entries per user. One of those still refers to my old
shell. Worse, if I try using chsh again, it fails with an "entry
inconsistent" error, and I have to restore the password files from
backup. Has anybody seen something like this before? This is just a
single system, with no NIS or LDAP.
-Alan
$ xxd /etc/pwd.db
...
00003bf0: e800 0003 e800 0000 0000 416c 616e 2053 ..........Alan S
00003c00: 6f6d 6572 7300 2f68 6f6d 652f 736f 6d65 omers./home/some
00003c10: 7273 002f 7573 722f 6c6f 6361 6c2f 6269 rs./usr/local/bi
00003c20: 6e2f 6669 7368 0000 0000 0000 0003 df41 n/fish.........A
...
00005c80: 0041 6c61 6e20 536f 6d65 7273 002f 686f .Alan Somers./ho
00005c90: 6d65 2f73 6f6d 6572 7300 2f75 7372 2f6c me/somers./usr/l
00005ca0: 6f63 616c 2f62 696e 2f62 6173 6800 0000 ocal/bin/bash...
...
00006c20: 03e8 0000 03e8 0000 0000 0041 6c61 6e20 ...........Alan
00006c30: 536f 6d65 7273 002f 686f 6d65 2f73 6f6d Somers./home/som
00006c40: 6572 7300 2f75 7372 2f6c 6f63 616c 2f62 ers./usr/local/b
00006c50: 696e 2f66 6973 6800 0000 0000 0000 03df in/fish.........
...
00007b40: 0041 6c61 6e20 536f 6d65 7273 002f 686f .Alan Somers./ho
00007b50: 6d65 2f73 6f6d 6572 7300 2f75 7372 2f6c me/somers./usr/l
00007b60: 6f63 616c 2f62 696e 2f66 6973 6800 0000 ocal/bin/fish...
$ chsh -s /usr/local/bin/fish
Password:
chsh: entry inconsistent
chsh: pw_copy: Invalid argument
More information about the freebsd-stable
mailing list