如何获取进程的ruid(真实用户ID)、euid(有效用户ID)、suid(保存的用户ID)和rgid(真实组ID)、egid(有效组ID)、sgid(保存的组ID),可以使用ps吗?
使用 Debian 的procps-ng:
$ ps -o pid,euid,ruid,suid,egid,rgid,sgid,cmd
PID EUID RUID SUID EGID RGID SGID CMD
28793 1000 1000 1000 1000 1000 1000 -/bin/bash
...
Run Code Online (Sandbox Code Playgroud)
在STANDARD FORMAT SPECIFIERS 手册页下:
Run Code Online (Sandbox Code Playgroud)euid EUID effective user ID (alias uid). euser EUSER effective user name. This will be the textual user ID, if it can be obtained and the field width permits, or a decimal representation otherwise.
等等。
FreeBSDps有svuidandsvgid而不是suidandsgid和 macOS 附带的那个只知道uid和gid有效的 UID 和 GID(不是euid或egid)。
在 Linux 上,还有文件系统访问 UID 和 GID,尽管它可能使用得不多(请参阅 参考资料setfsuid(2))。这些说明符是fuid/fsuid和fgid/ fsgid。
/proc/$pid/status 也包含它们,请参阅 proc(5)
| 归档时间: |
|
| 查看次数: |
7061 次 |
| 最近记录: |