大网数据广告活动
服务器运维问答

meaning of systemd "Group" option

· 52CE 我爱测

Here: http://man7.org/linux/man-pages/man5/systemd.exec.5.html There's a nice explanation stating there is something like "group that the processes are executed as". However, I could not find what this exactly is. I noticed that …

问题原文

原帖链接 · Herbert · CC BY-SA 3.0

Here:

http://man7.org/linux/man-pages/man5/systemd.exec.5.html

There's a nice explanation stating there is something like "group that the processes are executed as". However, I could not find what this exactly is. I noticed that setting the "Group" option in the systemd script changes permission on where files can be created. That is, without the option I was allowed to write a certain file, but with it I was not.

This suggests that the "group that the processes are executed as" does more than just determine what the group of newly created files are, it also elevates or reduces permissions.

Unfortunately, there is also something called a "process group" which is like a set of processes, which would not change permissions and rights I would think. But this makes the feature harder to google.

Could someone explain to me what the "group that the processes are executed as" is?

已采纳解答

原帖链接 · Mark Stosberg · CC BY-SA 3.0

"Group" there means "Unix group", referring to groups defined in /etc/group. Along with the User= directive, Group= sets the Unix user and group that a process is executed as.

The usual Unix permission model applies, so if you are running a "user service" from ~/.config/systemd, it's only valid to specify groups that the user is a member of.

From Multi-User Ownership and Permissions on Unix/Linux

processes also belong to a specific userid and group; this determines who is allowed to do what to a file (or directory which is a type of file), and which files a particular process is allowed to read, write or execute.

In practice, services that don't run as root tend to run as a user that is associated with a single group, making the Group= directive not particularly meaningful. For example, the MongoDB database runs as the mongodb user and the mongodb group. What matters there is that the group is unique so that what the MongoDB process can access is maximally limited.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-09-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。