Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add a root user check on serve #864

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/cmd/server/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/daytonaio/daytona/pkg/server/providertargets"
"github.com/daytonaio/daytona/pkg/server/registry"
"github.com/daytonaio/daytona/pkg/server/workspaces"
"github.com/daytonaio/daytona/pkg/views"
started_view "github.com/daytonaio/daytona/pkg/views/server/started"

log "github.com/sirupsen/logrus"
Expand All @@ -46,6 +47,10 @@ var ServeCmd = &cobra.Command{
GroupID: util.SERVER_GROUP,
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
if os.Getenv("USER") == "root" {
views.RenderInfoMessageBold("Running the server as root is not recommended because\nDaytona will not be able to remap project directory ownership.\nPlease run the server as a non-root user.")
}

if log.GetLevel() < log.InfoLevel {
// for now, force the log level to info when running the server
log.SetLevel(log.InfoLevel)
Expand Down
Loading