From 3c7fd3d37b079b512093d9e810c3e6cc9e002c2a Mon Sep 17 00:00:00 2001 From: JenTing Hsiao Date: Thu, 7 Jan 2021 10:55:23 +0800 Subject: [PATCH] Fix normal user with --rootless or --disable-agent have no permission to start Signed-off-by: JenTing Hsiao --- cmd/k3s/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/k3s/main.go b/cmd/k3s/main.go index 893afe0dcd..aee99fe017 100644 --- a/cmd/k3s/main.go +++ b/cmd/k3s/main.go @@ -57,7 +57,11 @@ func findDataDir() string { } dataDir := configfilearg.MustFindString(os.Args, "data-dir") if dataDir == "" { - dataDir = datadir.DefaultDataDir + if os.Getuid() == 0 { + dataDir = datadir.DefaultDataDir + } else { + dataDir = datadir.DefaultHomeDataDir + } logrus.Debug("Using default data dir in self-extracting wrapper") } return dataDir