From 0cfcc24b9337148e6cf2819b66d1bfa2d82241e7 Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Fri, 23 Feb 2024 10:31:22 -0500 Subject: [PATCH] Do not spin up desktop process for nobody user (#1620) --- ee/consoleuser/consoleuser_linux.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ee/consoleuser/consoleuser_linux.go b/ee/consoleuser/consoleuser_linux.go index b230a90c7..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) { @@ -36,8 +37,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 || s.Username == "nobody" { continue }