找到运行 Ubuntu 服务的用户?

Mil*_*hev 10 permissions services chown cassandra

我的 Ubuntu 上有一个 Cassandra 服务,但我无法确定该服务在哪个用户下运行。我知道如何找到文件和目录的所有者和权限。但是我如何为 Ubuntu 服务做到这一点。假设服务只是一个可执行文件,我如何找到特定服务的位置?

Que*_*tin 9

您可以使用ps -ef知道谁在运行 cassandra。

所有服务都位于/etc/init.d/.

如果您没有将 cassandra 作为服务运行,您可以使用以下whereis命令搜索程序在哪里:

$ whereis cassandra
Run Code Online (Sandbox Code Playgroud)

  • 打开文件 `/etc/init.d/cassandra` 并搜索是否可以看到类似 `daemon --user $CASS_USER` 的行(如该文件 https://gist.github.com/sgomezvillamor/5458309) (2认同)