rei*_*ost 8 rpm users dpkg apt package-management
在 Linux 发行版中,一些软件包会创建用户帐户。
如何确定哪个包创建了给定用户?
我想专门了解 Fedora 和 Ubuntu,但欢迎其他发行版的答案。
在基于 Debian 的系统(包括 Ubuntu)上,软件包使用维护者脚本创建用户,通常postinst. 因此,一种方法可能是通过这些脚本 grep:
grep -R --include='*.postinst' -e useradd -e adduser /var/lib/dpkg/info/
Run Code Online (Sandbox Code Playgroud)
当然,这假设postinst脚本尚未被删除(手动或因为您卸载了有问题的包)。
Debian 政策似乎有利于postinst:
[您]您必须安排您的包创建用户或组,如有必要
adduser,请在preinst或postinst脚本中使用(同样,如果可能,最好使用后者)。
包维护者也可以使用preinst,只要adduser是预依赖。
该政策还将我们引向另一个帐户来源:base-passwd包,如上一段所述:
如果您需要一个静态分配的 id,您必须向
base-passwd维护者索取一个用户或组 id ,并且在您被分配之前不得发布该包。一旦你被分配了一个,你必须要么使包依赖于包的版本,base-passwdid 存在于/etc/passwdor 中/etc/group,要么安排你的包创建用户或组本身,adduser在其preinstor 中使用正确的 id(使用)postinst。(postinst如果可能的话,最好在 the中进行,否则将需要对 adduser 包进行预先依赖。)
该base-passwd文件(/usr/share/doc/base-passwd/users-and-groups.txt.gz或/usr/share/doc/base-passwd/users-and-groups.html)说:
The Debian base-passwd package contains the master versions of /etc/passwd and
/etc/group. The update-passwd tool keeps the entries in these master files in
sync on all Debian systems. They comprise only "global static" ids: that is,
those which are reserved globally for the benefit of packages which need to
include files owned by those users or groups, or need the ids compiled into
binaries.
Run Code Online (Sandbox Code Playgroud)
包含的用户/组是(从 中提取出来的/usr/share/doc/base-passwd/users-and-groups.txt.gz):
root man majordom irc gdm
daemon lp postgres gnats saned
bin mail www-data nobody klog
sys news backup messagebus syslog
sync uucp operator postfix
games proxy list haldaemon
Run Code Online (Sandbox Code Playgroud)
adm fax audio staff sshd
tty voice src users fetchmail
disk cdrom shadow lpadmin cupsys
kmem floppy utmp sasl nogroup
dialout tape video scanner
dip sudo plugdev ssh
Run Code Online (Sandbox Code Playgroud)
包 README ( /usr/share/doc/base-passwd/README) 还列出了一些 UID 在 60000-64999 范围内的用户,并说明这些是由相应的包创建的。
AFAIK 没有本机包管理器功能可以创建(或删除)那些功能性/系统用户,但这是在 RPM 包中的自定义安装前或安装后脚本部分中完成的。
通常,RPM 包将创建并声明对这些用户的主目录的所有权,例如,该httpd包创建用户 apache,而 apache 用户的主目录由 httpd 包拥有,允许以一种迂回的方式找到该包:
rpm -qf /var/www
Run Code Online (Sandbox Code Playgroud)
您可以验证 httpd 包是否确实可以通过以下方式创建 apache 用户:
rpm -q --scripts httpd
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1621 次 |
| 最近记录: |