Debian:如何为用户 "sync" 设置空密码?

Debian: How to set an empty password for user "sync"?

https://wiki.debian.org/SystemGroups 的 Debian 文档说:

sync: The shell of user sync is /bin/sync. Thus, if its password is set to something easy to guess (such as ""), anyone can sync the system at the console even if they have don't have an account.

我想听从那个建议。但是允许特定用户使用空密码登录并不容易。

我想我必须以某种方式重新配置 PAM 才能允许这样做。

执行此操作的干扰最小的方法是什么?

我不想让所有用户都使用空密码,只是为了这个特定用户。

我也更愿意将额外的 "plug-in" 配置文件添加到 /etc/pam.d/ 而不是修改那里的现有文件(这可能会给将来的更新带来麻烦)。

这可能吗?如果,怎么办?

最简单的方法可能是直接编辑您的密码文件:

# vipw -s

(这将使用 "password editor"(vipw)打开 shadow 文件(-s)。

  1. 找到 "sync" 条目(它看起来像 sync:*:12345:0:99999:7:::
  2. 该行的第二个条目(*)是实际密码(*是一个非法密码,因此该帐户实际上被锁定;如果您设置了真实密码,您将查看一些哈希值)
  3. 删除密码,这样你会得到类似sync::12345:0:99999:7:::的东西 (因此第一个和第二个 : 冒号之间没有任何内容);保持该行的其余部分不变)
  4. 保存文件并退出编辑器

现在你已经完成了。以用户 sync.

登录进行测试
# login -f sync

otoh,我不太确定这是否真的是你想要的(因为它需要物理访问计算机才能以 sync 用户身份登录。ssh 将禁止空密码, ...)