Restore man user
There is a utility called update-passwd
that appears to do this safely for you:
NAME
update-passwd - safely update /etc/passwd, /etc/shadow and /etc/group
SYNOPSIS
update-passwd [options]
DESCRIPTION
update-passwd handles updates of /etc/passwd, /etc/shadow and
/etc/group on running Debian systems. It compares the current files to
master copies, distributed in the base-passwd package, and updates all
entries in the global system range (that is, 0–99).
First check the current entry
$ getent passwd man
man:x:6:12:man:/var/cache/man:/bin/sh
Now let's delete it
$ sudo deluser man
[sudo] password for steeldriver:
Removing user `man' ...
Warning: group `man' has no more members.
Done.
Check it's really gone
$ getent passwd man
$
Then
$ sudo update-passwd --dry-run
Adding group "man" (12)
Adding user "man" (6)
Would commit 2 changes
OK let's do it
$ sudo update-passwd
2 changes have been made, rewriting files
Now confirm the restored password file entry
$ getent passwd man
man:*:6:12:man:/var/cache/man:/bin/sh