-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
1. to developAccepted and waiting to be taken care ofAccepted and waiting to be taken care ofbuggood first issueSmall tasks with clear documentation about how and in which place you need to fix things in.Small tasks with clear documentation about how and in which place you need to fix things in.
Description
Even when both the nextcloud cronjob and the webserver is run by the same user, e.g. http, the cronjob still fails with the following error when config.php is owned by another user, e.g. root:
Console has to be executed with the same user as the web server is operated
Current user: http
Web server user: root
This is due to cron.php actually checking not for executing users, but for file ownership:
$user = posix_getpwuid(posix_getuid());
$configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php'));
if ($user['name'] !== $configUser['name']) {
echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL;
echo "Current user: " . $user['name'] . PHP_EOL;
echo "Web server user: " . $configUser['name'] . PHP_EOL;
exit(1);
}
I don't know if if the message is wrong and cron.php is supposed to test file owbership (if so it would probably be better if it checked writability), or the message is right and cron.php is testing the wrong thing, but in either case, the message is highly misleading, because adjusting the users running the webserver and the cronjob will not fix the error.
Steps to reproduce
- run webserver and cronjob by same user
- change ownership of config.php to a different user (needs still to be writable by the webserver via group permissions)
- run cronjob
Expected behaviour
No error or error because of wrong file ownership
Actual behaviour
Error because of wrong users running webserver/cronjob
Metadata
Metadata
Assignees
Labels
1. to developAccepted and waiting to be taken care ofAccepted and waiting to be taken care ofbuggood first issueSmall tasks with clear documentation about how and in which place you need to fix things in.Small tasks with clear documentation about how and in which place you need to fix things in.