Bug 1518986 - Please add AUID to list of selectable fields in ps.
Summary: Please add AUID to list of selectable fields in ps.
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: procps-ng
Version: 7.6
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jan Rybar
QA Contact: Branislav Náter
Marie Dolezelova
URL:
Whiteboard:
Keywords: Improvement, Patch, Upstream
Depends On:
Blocks: 1477664 1546815 1549617 1549689 1551061
TreeView+ depends on / blocked
 
Reported: 2017-11-29 22:22 UTC by Thomas Gardner
Modified: 2018-10-30 07:57 UTC (History)
6 users (show)

(edit)
The *ps* utility now displays the Login ID associated with processes

The new format option "luid" of the *ps* utility now enables you to display the Login ID associated with processes.

To display the login ID attributes of running processes, use the following command:

    $ ps -o luid
Clone Of:
(edit)
Last Closed: 2018-10-30 07:56:26 UTC


Attachments (Terms of Use)
proposed patch (2.29 KB, patch)
2018-02-09 17:39 UTC, Jan Rybar
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3045 None None None 2018-10-30 07:57 UTC

Description Thomas Gardner 2017-11-29 22:22:40 UTC
Description of problem:

Every other type of UID that I can think of for a process to have (EUID, RUID, FUID, SUID) can be selected as a field to be displayed in ps output, but not AUID (AKA loginID).  We have a customer that needs to see this in ps output for some scripts he's writing because by the time his script gets the ps output, finds the process it's after, the short-lived process exits.  He can't just have his script go look it up for itself in /proc/###/loginid because that directory disappears when the process exits, before his script has a chance to go get it.

It seems reasonable to ask that it be a valid field in the ps output as every other kind of UID (as far as I can recall) is available.

I doubt we'll have this in time to help this exact situation, but it makes sense to include it anyway for the next guy with the same problem.

Comment 1 Jan Rybar 2017-11-30 13:48:12 UTC
Hello,

it seems to be present in upstream as LUID (loginID) ($ ps -o LUID).
If that is what you meant, I shall backport it in rhel-7.6.

Thanks.

Comment 2 Thomas Gardner 2017-12-04 16:45:02 UTC
Yup.  loginID and AUID are synonymous.  If we wanna call it LUID, too, welp, I guess we can add another synonym.  :-)

Comment 3 Thomas Gardner 2017-12-04 16:47:01 UTC
Oh, yeah, and I'm guessing that the man page will also be updated as part this request reflecting the change in function, right?

Comment 4 Jan Rybar 2017-12-05 10:32:25 UTC
Of course :)
Unless you want to make it an easter egg :D

Comment 5 Jan Rybar 2018-01-19 13:08:55 UTC
I've just peeked at the history of the LUID feature in upstream and it seems to be present there since 2003. And yes, it's in RHEL7 and Fedora also! It just appears to be missing from manpage.

Try the following:
$ ps -eo pid,luid,cmd


Is it the result expected by the customer?

Thanks.

PS: manpage fix is on the way.

Comment 6 Brett Lowry 2018-02-05 18:47:21 UTC
Displaying the the auid is not just a man page fix for the ps command.

iaasn00052525# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
iaasn00052525# id -a
uid=0(root) gid=0(root) groups=0(root)
iaasn00052525# date
Mon Feb  5 13:31:55 EST 2018
iaasn00052525# ps -eo pid,luid,cmd | head
   PID  LUID CMD
     1     - /sbin/init
     2     - [kthreadd]
     3     - [migration/0]
     4     - [ksoftirqd/0]
     5     - [stopper/0]
     6     - [watchdog/0]
     7     - [migration/1]
     8     - [stopper/1]
     9     - [ksoftirqd/1]
iaasn00052525#

The LUID is blank in the ps output. This needs to be fixed. Having it work with -o auid would make sense too, as a suggestion.

Please move forward with a real fix/update.

- Brett Lowry J.P. Morgan Chase.

Comment 7 Brett Lowry 2018-02-05 18:51:46 UTC
Here is a RHEL 7.3 as well:
ashamvarchlab02# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)
ashamvarchlab02# id -a
uid=0(root) gid=0(root) groups=0(root) context=system_u:system_r:unconfined_service_t:s0
ashamvarchlab02# date
Mon Feb  5 13:51:17 EST 2018
ashamvarchlab02# ps -eo pid,luid,cmd | head
  PID  LUID CMD
    1     - /usr/lib/systemd/systemd --switched-root --system --deserialize 20
    2     - [kthreadd]
    3     - [ksoftirqd/0]
    5     - [kworker/0:0H]
    7     - [migration/0]
    8     - [rcu_bh]
    9     - [rcu_sched]
   10     - [watchdog/0]
   11     - [watchdog/1]
ashamvarchlab02#


- Brett Lowry J.P. Morgan Chase.

Comment 8 Jan Rybar 2018-02-09 17:38:02 UTC
Yes, the code in upstream seems like a preparation for the functionality, but without an actual implementation.

The patch implementing the functionality has been sent to upstream.
It will be merged into the nearest RHEL minor release as quickly as it gets merged into upstream.

Comments welcomed.

Comment 9 Jan Rybar 2018-02-09 17:39 UTC
Created attachment 1393936 [details]
proposed patch

Comment 10 Jan Rybar 2018-02-23 11:36:33 UTC
Fix accepted by upstream.
This BZ proposed to rhel-7.6.

Comment 18 errata-xmlrpc 2018-10-30 07:56:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3045


Note You need to log in before you can comment on or make changes to this bug.