Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Add support or documentation for "timestamp_timeout = 0" scenario #13

Closed
yuriybabenko opened this issue Feb 16, 2016 · 3 comments
Closed

Comments

@yuriybabenko
Copy link

Have been struggling with getting sudo-prompt to work, and finally figured out why. My environment's timestamp timeout was set to 0. This resulted in attempt()'s check of the if (/sudo: /i.test(stderr)) condition always matching, and throwing an error on the second command execution.

It would be nice if there was either a) a workaround, or b) a check for this condition within sudo-prompt and subsequent user notification.

@jorangreef
Copy link
Owner

Are you on OS X?

Are you getting User did not grant permission. as an error message?

Would you be able to find out if there is any way to detect whether the sudo timestamp timeout is 0? If so, we could fall back to another version of attempt() which does not assume that timeouts on OS X are non-zero, and which will run the command directly as part of the AppleScript applet, which is normally used to extend the sudo timestamp. Would you be able to help with this?

@yuriybabenko
Copy link
Author

Yes, I'm on OSX 10.10.4.

I looked around and I'm not seeing a way to check the current sudo timeout. The value is set in /etc/sudoers, but you need sudo permissions to actually read the file, so it can't be parsed.

It may be possible to tell sudo to use sudo-prompt's applet.app as the GUI for ASKPASS. Alternatively, these two resources seem to be on the right track:

Will investigate this further when I have more time.

@jorangreef
Copy link
Owner

I have been thinking about it some more. I will try to rewire attempt() so that it does not assume that sudo timeouts are non-zero. Instead it will:

  1. Try sudo -n to run the command if possible (if a sudo session already exists).
  2. Use the applet's administrator privileges to set the timeout as well as run the provided command.

This will give the best of both worlds. A sudo session which endures across multiple commands if possible, and support for systems with the sudo timeout set to 0.

It will take me some time but I hope to get started on it soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants