我的/etc/passwd文件中的debian-tor是谁?

我在/etc/passwd文件中找到了这个条目:
debian-tor:x:117:123::/var/lib/tor:/bin/false

但是没有/var/lib/tor文件夹。这是在服务器上而不是桌面上。

2这是一个由您安装某个东西创建的用户。很可能您安装了tor - Pilot6
1个回答

这是一个由安装tor或tor-browser创建的用户。
例如,如果您查看tor软件包的postinst脚本,您会看到:
# checking debian-tor account

uid=`getent passwd debian-tor | cut -d ":" -f 3`
home=`getent passwd debian-tor | cut -d ":" -f 6`

# if there is the uid the account is there and we can do
# the sanit(ar)y checks otherwise we can safely create it.

if [ "$uid" ]; then
    if [ "$home" = "/var/lib/tor" ]; then
        :
        #echo "debian-tor homedir check: ok"
    else
        echo "ERROR: debian-tor account has an unexpected home directory!"
        echo "It should be '/var/lib/tor', but it is '$home'."
        echo "Removing the debian-tor user might fix this, but the question"
        echo "remains how you got into this mess to begin with."
        exit 1
    fi
else
    adduser --quiet \
        --system \
        --disabled-password \
        --home /var/lib/tor \
        --no-create-home \
        --shell /bin/false \
        --group \
        debian-tor
fi


for i in lib log; do
    if ! [ -d "/var/$i/tor" ]; then
        echo "Something or somebody made /var/$i/tor disappear."
        echo "Creating one for you again."
        mkdir "/var/$i/tor"
    fi
done

which restorecon >/dev/null 2>&1 && restorecon /var/lib/tor
chown debian-tor:debian-tor /var/lib/tor
chmod 02700 /var/lib/tor

which restorecon >/dev/null 2>&1 && restorecon /var/log/tor
chown debian-tor:adm /var/log/tor
chmod 02750 /var/log/tor

但是当你卸载tor时,这个用户并没有被删除。我没有看到任何在prerm或postrm脚本中删除用户的内容。
所以这意味着你安装了tor,或者之前安装过它。
在系统中多一个用户并没有什么问题,但如果你愿意,可以将其删除。
你可以通过运行以下命令来删除该用户:
sudo deluser debian-tor

这就是我为什么提问的原因。我从未在Web服务器上安装过Tor,也永远不会安装。所以我的后续问题是,我该如何查看你在回答中提到的安装后文件,并且如何删除用户并清除系统?如果我运行tor -v,它显示未安装。 另外,/var/lib/tor目录不存在。 - fndtn357
1我添加了如何从您的系统中删除用户的说明。postinst文件位于tor deb中。很可能是有人安装了tor然后将其卸载。我无法猜测更多。 - Pilot6
谢谢。有趣的回应之后 - 移除用户 debian-tor' ... 警告:组 debian-tor' 没有更多成员。 完成。 - fndtn357
所以你也可以删除这个群组。没什么特别的。这个群组只有一个用户。 - Pilot6
groupdel:组 'debian-tor' 不存在 这一切看起来都很可疑。 - fndtn357
2很可能当你从该组中删除了唯一的用户时,该组被自动删除了。 - Pilot6
对我来说,需要一些权威的链接。比如这个 - N0rbert
@N0rbert 任何人都可以从Ubuntu软件仓库下载tor并查看postinst脚本。 - Pilot6