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

Refactor script to be sudoers-friendly #87

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ExoticMatter
Copy link

By extracting the parts of the script that require sudo into a different script, it is (probably) safe to add the extracted script to your sudoers file for use with NOPASSWD.

(Also includes unrelated error handling [if one module fails to load, the rest of the commands will probably fail too; if one can't be unloaded, you can't shut off the GPU])

@lilydjwg
Copy link

lilydjwg commented Apr 8, 2019

I have another idea: refactor script so that users are required to run with sudo. Invoking sudo inside will work poorly on exit: it prompts the user to enter password again.

nvidia-xrun.txt

@Witko Witko added this to the Version 0.4.0 milestone May 6, 2019
BobbyWibowo referenced this pull request in BobbyWibowo/nvidia-xrun Oct 23, 2019
@tangxinfa
Copy link

I'm try to fix this problem by rewrite the privilege functions with C:

https://github.com/tangxinfa/nvidia-xrun.git

Implementing details:

The privilege functions use by `nvidia-xrun` was rewrited with C program
`nvidia-xrun-util`, we put the set-user-ID and set-group-ID  bits to the
executable. When executed it will parse the config file
`/etc/default/nvidia-xrun` by itself, then `setuid`/`setgid` to `root` user
for call privilege operations.

So it will not introduce new security problems.

Anyone interesting can try it:

# Build
git clone https://github.com/tangxinfa/nvidia-xrun.git
cd nvidia-xrun
git checkout fix-no-sudo
make permission
# Install by overwrite original nvidia-xrun executable files
sudo ln -sf ./nvidia-xrun /usr/bin/nvidia-xrun
sudo ln -sf ./nvidia-xrun-util /usr/bin/nvidia-xrun-util

If anyone like it i will make a pull request.

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

Successfully merging this pull request may close these issues.

4 participants