Skip to content

Commit 6a4e200

Browse files
committed
Change to /var/run directory before starting vde_switch
vde_switch calls `getcwd` as the daemon user, so fails in directories like ~/Downloads which have 700 permissions. Signed-off-by: Jan Dubois <[email protected]>
1 parent 3bc6378 commit 6a4e200

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/networks/reconcile/reconcile.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ func startDaemon(config *networks.NetworksConfig, ctx context.Context, name, dae
113113
args := []string{"--user", config.DaemonUser(daemon), "--group", config.DaemonGroup(daemon), "--non-interactive"}
114114
args = append(args, strings.Split(config.StartCmd(name, daemon), " ")...)
115115
cmd := exec.CommandContext(ctx, "sudo", args...)
116+
// set directory to a path the daemon user has read access to because vde_switch calls getcwd() which
117+
// can fail when called from directories like ~/Downloads, which has 700 permissions
118+
cmd.Dir = config.Paths.VarRun
116119
cmd.Stdout = stdoutW
117120
cmd.Stderr = stderrW
118121
logrus.Debugf("Starting %q daemon for %q network: %v", daemon, name, cmd.Args)

0 commit comments

Comments
 (0)