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

Execution as root #17

Open
undefined-moe opened this issue Dec 30, 2023 · 2 comments
Open

Execution as root #17

undefined-moe opened this issue Dec 30, 2023 · 2 comments

Comments

@undefined-moe
Copy link

When directly running under root user, it still checks for $SUDO_USER.

thread 'main' panicked at 'Must be in sudo mode. ENV variable $SUDO_USER not found: NotPresent', src/handlers/handle_create_service.rs:162:31
@secretshardul
Copy link
Contributor

The User field in a .service file should be a regular user, not root. Can you get me the results of-

# User under normal operation (hp)
echo $USER

# Run as root
sudo su

# User under sudo mode (root)
echo $USER
# The normal operation user (hp)
echo $SUDO_USER
  • $USER should be something like hp (whatever your default user is) and root in sudo mode
  • $SUDO_USER should be your normal user, eg. hp

Which distro are you running? Usually $SUDO_USER will have a value.

As a hack you could set $SUDO_USER manually.

SUDO_USER=hp
servicer

@undefined-moe
Copy link
Author

Thanks for your reply. I'm running ubuntu jammy in a linux container so that I prefer to execute them directly as root instead of creating another user.

SUDO_USER=root servicer ... actually worked for me, I just wonder if execution as root will be supported in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants