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

--help needs root permissions #24

Open
rumpelsepp opened this issue Nov 26, 2015 · 1 comment
Open

--help needs root permissions #24

rumpelsepp opened this issue Nov 26, 2015 · 1 comment
Labels
Milestone

Comments

@rumpelsepp
Copy link

$ ./snazzer --help
[sudo] password for stefan:

--help should not ask for root permissions.

@csirac2 csirac2 added the bug label Dec 31, 2015
@csirac2 csirac2 added this to the 0.6 milestone Dec 15, 2016
@jamiereid
Copy link

The offending line appears to be if ! $SUDO test -e "$SNAZZER_SUBVOLS_EXCLUDE_FILE"; then
$SUDO is set to sudo if snazzer is not being run as root.

I believe the sudo is there because $SNAZZER_SUBVOLS_EXCLUDE_FILE defaults to /etc/snazzer/exclude.patterns

Is there a better solution than moving the case check for --help to be above these lines?

jamiereid added a commit to jamiereid/snazzer that referenced this issue Dec 21, 2016
Checking for the existance of /etc/snazzer/exclude.patterns is achieved
through the use of sudo when snazzer is run as an unprivileged user.

By moving the argument detection to top of script we can avoid situations
where root privileges were required for commands that don't need elevated
privileges (such as --help).

Resolves: csirac2#24
jamiereid added a commit to jamiereid/snazzer that referenced this issue Dec 21, 2016
This allows the code to only be called when needed, instead of every time snazzer
is run.

Also remove `$SUDO` from the `test -e`.

This solution replaces the one in commit b57fa2b after discussions with @csirac2
and @florianjacob

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

No branches or pull requests

3 participants