From 136769227aa5c0171bcae6bf5298302e2dd8d278 Mon Sep 17 00:00:00 2001 From: Nikitas Rontsis Date: Sat, 12 Oct 2024 15:47:22 +0100 Subject: [PATCH] Replace direct use of su with sudo su To avoid complications when running in restricted pod security standard environment https://github.com/loft-sh/devpod-provider-kubernetes/issues/12 --- pkg/devcontainer/setup/lifecyclehooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/devcontainer/setup/lifecyclehooks.go b/pkg/devcontainer/setup/lifecyclehooks.go index 82b727f0a..00715d922 100644 --- a/pkg/devcontainer/setup/lifecyclehooks.go +++ b/pkg/devcontainer/setup/lifecyclehooks.go @@ -98,7 +98,7 @@ func run(commands []types.LifecycleHook, user, dir string, remoteEnv map[string] log.Infof("Run command %s: %s...", k, strings.Join(c, " ")) args := []string{} if user != "root" { - args = append(args, "su", user, "-c", command.Quote(c)) + args = append(args, "sudo", "su", user, "-c", command.Quote(c)) } else { args = append(args, "sh", "-c", command.Quote(c)) }