From 66a792292a279809908bf50b66d924eb789b41f1 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 12 Jan 2025 09:25:26 -0800 Subject: [PATCH] Run cron commands in the user's home dir https://github.com/webmin/webmin/issues/2355: --- cron/exec_cron.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cron/exec_cron.cgi b/cron/exec_cron.cgi index 89cda1207..56c56cab6 100755 --- a/cron/exec_cron.cgi +++ b/cron/exec_cron.cgi @@ -39,12 +39,13 @@ foreach $e (&read_envs($job->{'user'})) { } if (&supports_users()) { - # Get command and switch uid/gid + # Get command and switch uid/gid and home directory @uinfo = getpwnam($job->{'user'}); $ENV{"HOME"} = $uinfo[7]; $ENV{"SHELL"} = "/bin/sh"; $ENV{"LOGNAME"} = $ENV{"USER"} = $job->{'user'}; &switch_to_unix_user(\@uinfo); + chdir($uinfo[7]); } if ($in{'bg'}) {