From acf04f46a0906813bf33e371de3f5ac0bd3ff98d Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Fri, 23 Feb 2024 10:08:10 -0500 Subject: [PATCH 1/2] Do not spin up desktop process for nobody user --- ee/consoleuser/consoleuser_linux.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ee/consoleuser/consoleuser_linux.go b/ee/consoleuser/consoleuser_linux.go index b230a90c7..0954a11db 100644 --- a/ee/consoleuser/consoleuser_linux.go +++ b/ee/consoleuser/consoleuser_linux.go @@ -36,8 +36,9 @@ func CurrentUids(ctx context.Context) ([]string, error) { var uids []string for _, s := range sessions { - // generally human users start at 1000 on linux - if s.UID < 1000 { + // 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 { continue } From 05855861e8735b082b62cba1ee1250b1752dfa7c Mon Sep 17 00:00:00 2001 From: RebeccaMahany Date: Fri, 23 Feb 2024 10:22:26 -0500 Subject: [PATCH 2/2] 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 }