Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Add local export option to vagrant lxc sudoers #350

Closed
Ramblurr opened this issue Feb 25, 2015 · 5 comments
Closed

Add local export option to vagrant lxc sudoers #350

Ramblurr opened this issue Feb 25, 2015 · 5 comments
Labels

Comments

@Ramblurr
Copy link

Related to #349 but a feature request

I run vagrant on a user with no sudo general permissions, so I need to setup the sudoers exceptions in a different user. I hacked the script on the wiki to use the correct values $SUDO_USER and $HOME in my use case.

It would be helpful if there was a vagrant lxc sudoers --export flag that output the sudoers contents to STDIN or a local file, so I can manually copy it to /etc/sudoers.d/X myself.

@Ramblurr
Copy link
Author

Another reason this feature is needed:

On Fedora the root has a different PATH than my user.

As root (when I run sudo vagrant lxc sudoers) /bin is first in the path, whereas when I run vagrant as my user /usr/bin is first. This results in a wrapper file that uses an lxc_bin of /bin, but the vagrant user is passing in /usr/bin/ as a path.

@kupferk
Copy link

kupferk commented Feb 25, 2015

Just as a side note. Concering the order of the PATH search path, I found out that you can also adjust the sudoer PATH variable in the file /etc/sudoers. For example on my Ubuntu machine I have

Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

On Fedora its probably slightly different. There are more subtle differences between the Fedora and Ubuntu versions of the sudoers file, which cause some confusions on my side from time to time when using sudo.

@Ramblurr Maybe adjusting the secure_path variable is viable for you to fix the behaviour.

@Ramblurr
Copy link
Author

@kufperk, thanks for the advice. I did consider secure_path however, and in this case it isn't related to the issue.

Changing secure_path only affects the execution of the wrapper script, not its contents.

The problem is vagrant-lxc is creating the vagrant-lxc-wrapper script and whitelising commands with /bin, but when vagrant is run under my normal user it executes commands with /usr/bin. Since the script only whitelisted /bin/, the commands are rejected.

@kupferk
Copy link

kupferk commented Feb 25, 2015

@Ramblurr ah, I understand. Actually I have to admit I didn't test changing the secure_path in order to fix the issue with vagrant-lxc-wrapper. But I understand where you are coming from, I also modified the results by hand in order to get vagrant-lxc running on Fedora. I think your suggestion makes sense for such cases.

@fgrehm
Copy link
Owner

fgrehm commented Nov 17, 2022

Hey, sorry for the silence here but this project is looking for maintainers 😅

As per #499, I've added the ignored label and will close this issue. Thanks for the interest in the project and LMK if you want to step up and take ownership of this project on that other issue 👋

@fgrehm fgrehm closed this as completed Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants