Skip to content

Commit

Permalink
Add check for username too
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Feb 23, 2024
1 parent acf04f4 commit 0585586
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ee/consoleuser/consoleuser_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
}

Expand Down

0 comments on commit 0585586

Please sign in to comment.