From 05855861e8735b082b62cba1ee1250b1752dfa7c Mon Sep 17 00:00:00 2001 From: RebeccaMahany Date: Fri, 23 Feb 2024 10:22:26 -0500 Subject: [PATCH] Add check for username too --- ee/consoleuser/consoleuser_linux.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ee/consoleuser/consoleuser_linux.go b/ee/consoleuser/consoleuser_linux.go index 0954a11db..0b1986a0d 100644 --- a/ee/consoleuser/consoleuser_linux.go +++ b/ee/consoleuser/consoleuser_linux.go @@ -13,9 +13,10 @@ import ( ) type listSessionsResult []struct { - Session string `json:"session"` - UID int `json:"uid"` - Seat string `json:"seat"` + Session string `json:"session"` + UID int `json:"uid"` + Username string `json:"user"` + Seat string `json:"seat"` } func CurrentUids(ctx context.Context) ([]string, error) { @@ -38,7 +39,7 @@ func CurrentUids(ctx context.Context) ([]string, error) { for _, s := range sessions { // generally human users start at 1000 on linux. 65534 is reserved for https://wiki.ubuntu.com/nobody, // which we don't want to count as a current user. - if s.UID < 1000 || s.UID == 65534 { + if s.UID < 1000 || s.UID == 65534 || s.Username == "nobody" { continue }