![恢复 man 用户](https://linux22.com/image/983105/%E6%81%A2%E5%A4%8D%20man%20%E7%94%A8%E6%88%B7.png)
由于阅读困难(或者睡眠不足),我输入了
deluser man
而不是更常见的
man deluser
...正如您所想象的,我刚刚删除了 man user!以前从未发生过这种情况...
如何正确恢复系统的 man 用户?
答案1
有一个名为的实用程序update-passwd
似乎可以为您安全地完成此操作:
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).
首先检查当前条目
$ getent passwd man
man:x:6:12:man:/var/cache/man:/bin/sh
现在让我们删除它
$ sudo deluser man
[sudo] password for steeldriver:
Removing user `man' ...
Warning: group `man' has no more members.
Done.
检查它是否真的消失了
$ getent passwd man
$
然后
$ sudo update-passwd --dry-run
Adding group "man" (12)
Adding user "man" (6)
Would commit 2 changes
好的,让我们一起做
$ sudo update-passwd
2 changes have been made, rewriting files
现在确认恢复的密码文件条目
$ getent passwd man
man:*:6:12:man:/var/cache/man:/bin/sh