summaryrefslogtreecommitdiff
path: root/internal/user/name.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/user/name.go')
-rw-r--r--internal/user/name.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/internal/user/name.go b/internal/user/name.go
index 5171ec7..28ab0a4 100644
--- a/internal/user/name.go
+++ b/internal/user/name.go
@@ -2,10 +2,10 @@ package user
import (
"os/user"
- )
+)
-
-func Name() string {
+// NoRootCheck verifies that the DTail run user is not with UID or GID 0.
+func NoRootCheck() {
user, err := user.Current()
if err != nil {
panic(err)
@@ -18,7 +18,14 @@ func Name() string {
if user.Gid == "0" {
panic("Not allowed to run as GID 0")
}
+}
+
+// Name of the current run user.
+func Name() string {
+ user, err := user.Current()
+ if err != nil {
+ panic(err)
+ }
return user.Username
}
-