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

make it possible to run occ as root #33545

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

make it possible to run occ as root #33545

wants to merge 1 commit into from

Conversation

karlitschek
Copy link
Member

make it possible to run as root

Signed-off-by: Frank Karlitschek karlitschek@users.noreply.github.com

@karlitschek
Copy link
Member Author

@PVince81 PVince81 added the 3. to review Waiting for reviews label Aug 15, 2022
@PVince81 PVince81 added this to the Nextcloud 25 milestone Aug 15, 2022
occ
Comment on lines +11 to +13
if (posix_getuid() == 0){
$command = implode (' ', $argv);
echo(shell_exec('sudo -u www-data '.$command));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (posix_getuid() == 0){
$command = implode (' ', $argv);
echo(shell_exec('sudo -u www-data '.$command));
if (posix_getuid() === 0) {
$command = implode (' ', $argv);
echo shell_exec('sudo -u www-data ' . $command);

return code is being killed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

occ
Comment on lines +11 to +13
if (posix_getuid() == 0){
$command = implode (' ', $argv);
echo(shell_exec('sudo -u www-data '.$command));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

occ
// make it possible to run as root
if (posix_getuid() == 0){
$command = implode (' ', $argv);
echo(shell_exec('sudo -u www-data '.$command));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

www-data might not be the default user name for the HTTP server though, mostly only Debian-based systems use that. RedHat-based systems or ArchLinux use an user named http by default.

Also, does this forwards environment variables?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what we do in other places is read the user name from the config file, basically the owner of "config/config.php" and use that to check if the correct user is being used

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense unless config_is_read_only is used, then the config file owner could be something irrelevant such as root, as long as the http server user has read access.

@skjnldsv skjnldsv mentioned this pull request Aug 18, 2022
This was referenced Aug 24, 2022
This was referenced Sep 6, 2022
@skjnldsv skjnldsv mentioned this pull request Sep 15, 2022
This was referenced Sep 20, 2022
@blizzz blizzz modified the milestones: Nextcloud 25, Nextcloud 26 Sep 22, 2022
@blizzz blizzz mentioned this pull request Feb 1, 2023
@skjnldsv skjnldsv mentioned this pull request Feb 23, 2023
@blizzz blizzz mentioned this pull request Mar 7, 2023
@blizzz blizzz modified the milestones: Nextcloud 26, Nextcloud 27 Mar 9, 2023
This was referenced May 3, 2023
@skjnldsv skjnldsv removed this from the Nextcloud 27 milestone May 9, 2023
@blizzz blizzz added this to the Nextcloud 29 milestone Nov 23, 2023
This was referenced Mar 12, 2024
@Altahrim Altahrim mentioned this pull request Mar 20, 2024
@AndyScherzinger AndyScherzinger removed this from the Nextcloud 29 milestone Mar 22, 2024
@AndyScherzinger
Copy link
Member

@karlitschek I believe we can close this PR since it was originally planned/needed as a pre-requisite for Nc Guard, right?

make it possible to run as root

Signed-off-by: Frank Karlitschek <karlitschek@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews feature: occ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants