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

[ERROR] sudo: unrecognized option '--preserve-env=EDITOR' #11

Closed
d3-X-t3r opened this issue May 3, 2024 · 3 comments
Closed

[ERROR] sudo: unrecognized option '--preserve-env=EDITOR' #11

d3-X-t3r opened this issue May 3, 2024 · 3 comments

Comments

@d3-X-t3r
Copy link

d3-X-t3r commented May 3, 2024

I'm trying to run pikaur in Arch as a normal user, eg pikaur -S foo, which calls sudo internally. But this fails with doas-sudo-shim with the error:

sudo: unrecognized option '--preserve-env=EDITOR'
Usage:
  sudo (-i | -s) [-n] [-u <user>] [<command> [--] [<args>...]]
  sudo [-ins] [-u <user>] <command> [--] [<args>...]
  sudo [-h]

Execute a command as another user using doas(1).

This is not the original sudo, but the doas shim for sudo. It supports only
a subset of the sudo options (both short and long) that have an equivalent in
doas, plus option -i (--login). Refer to sudo(1) for more information.

Please report bugs at <https://github.com/jirutka/doas-sudo-shim/issues>.

Distro: Arch Linux
App: pikaur v1.20.r6.g1821e8d

@jirutka
Copy link
Owner

jirutka commented May 5, 2024

doas (OpenDoas) doesn’t have any equivalent for this option, so there’s nothing we can do about it.

@jirutka jirutka closed this as completed May 5, 2024
@vladaviedov
Copy link

doas (OpenDoas) doesn’t have any equivalent for this option, so there’s nothing we can do about it.

What about using the env command? It's not pretty, but converting the call to doas env EDITOR=$EDITOR does get the job done.

@jirutka jirutka reopened this Sep 22, 2024
@jirutka
Copy link
Owner

jirutka commented Jan 4, 2025

doas env EDITOR=$EDITOR does get the job done.

This also bypasses doas’ security mechanism for filtering environment variables. Even sudo’s --preserve-env is subordinate to the configured security rules.

I don’t see any way how to implement this securely in a simple shell script.

@jirutka jirutka closed this as completed Jan 4, 2025
@jirutka jirutka reopened this Jan 6, 2025
@jirutka jirutka closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
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

3 participants