lanayotech / vagrant-manager

Manage your vagrant machines in one place with Vagrant Manager for OS X
vagrantmanager.com
MIT License
1.86k stars 84 forks source link

Vagrant keeps requesting SU password #143

Closed Dragooon closed 7 years ago

Dragooon commented 8 years ago

Hello! Awesome software there. I just have a little issue, I'm using a plugin for vagrant which automatically takes care of my hosts file and it requires su password which is okay but when I run the same command through Vagrant, it requests it at least 6 times before the machine runs. Is there a way to fix this?

jjanusch commented 8 years ago

I've had this problem since upgrading to Sierra. Each time I up a machine through Vagrant Manager, it requests my password 4-6 times. If I do it through CLI, it only asks once.

chriswayoub commented 8 years ago

I'm seeing this issue on Sierra as well. It looks like Vagrant actually runs 4 sudo commands when configuring NFS, so it's prompting 4 times. The terminal remembers your sudo password for a short while so it only prompts you once, but the same is not happening in the NSTask in Vagrant Manager for some reason. I haven't come up with any solution within Vagrant Manager itself yet, but this sudoers adjustment stopped it from prompting me multiple times:

http://stackoverflow.com/questions/39474047/sudo-command-on-macos-sierra-does-not-respect-timestamp-timeout

Here is some info about the security ramifications of changing that option:

https://derflounder.wordpress.com/2016/09/21/tty_tickets-option-now-on-by-default-for-macos-sierras-sudo-tool/

jjanusch commented 8 years ago

I can confirm that the method mentioned by @chriswayoub does suppress the password prompts. I don't know of a way to fix it in Vagrant Manager, however.

1stevengrant commented 8 years ago

seeing this issue as well :( such a pain

bensquire commented 7 years ago

Same here!

LarkRiseMedia commented 7 years ago

fixed using @chriswayoub solution above. and relax . . .

joshlopes commented 7 years ago

As anyone found a solution for this ?

wireblue commented 7 years ago

Also using macOS Sierra and looking for a proper solution.

Disabling tty_tickets doesn't sound like a good idea.

aberonni commented 7 years ago

Any updates on this? I'm encountering the same issue on macOS Sierra.

acrosman commented 7 years ago

Looks like there are solutions to this through the Authorization Services Programming Guide but they are somewhat involved. Looks like getting NSTask to play nicely with privilege escalation is intentionally hard to force people to do it "right".

acrosman commented 7 years ago

There may be a vagrant/sudo work around if you are willing to allow an escalation without a password entirely: https://askubuntu.com/a/519841 (I have not tried this myself, but seems likely to bypass this issue).

chriswayoub commented 7 years ago

I don't think there is a good way to resolve this on our end. The "right" way would be to use privilege escalation, but in that case it's going to ask you for your password every single time regardless of whether or not it needs it for the command it is running, and I don't think that's convenient at all. There isn't a great way for us to know whether or not the command you are running actually requires privilege escalation beforehand. I think the best solution is the one mentioned in the Vagrant docs. Sorry for this inconvenient behavior, if anyone has a good solution then we can re-open this issue.