From 4c4f7a3331b8f0d6f76fabcbc202e7a955685248 Mon Sep 17 00:00:00 2001 From: Andres Martinez Gotor Date: Thu, 3 Oct 2024 09:09:54 +0200 Subject: [PATCH] Chore: Restore permissions used to create plugins dir (#94139) --- pkg/cmd/grafana-cli/commands/install_command.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/grafana-cli/commands/install_command.go b/pkg/cmd/grafana-cli/commands/install_command.go index d8624578220..e09d84a9721 100644 --- a/pkg/cmd/grafana-cli/commands/install_command.go +++ b/pkg/cmd/grafana-cli/commands/install_command.go @@ -51,7 +51,10 @@ func validateInput(c utils.CommandLine) error { fileInfo, err := os.Stat(pluginsDir) if err != nil { - if err = os.MkdirAll(pluginsDir, 0o750); err != nil { + // If the directory does not exist, try to create it with permissions enough + // so the server running Grafana can write to it to install new plugins. + // nolint: gosec + if err = os.MkdirAll(pluginsDir, os.ModePerm); err != nil { return fmt.Errorf("pluginsDir (%s) is not a writable directory", pluginsDir) } return nil