|
Bugzilla – Full Text Bug Listing |
| Summary: | Add a command to know if authentication cache is active | ||
|---|---|---|---|
| Product: | Sudo | Reporter: | Eric Leblond <eric> |
| Component: | Sudo | Assignee: | Todd C. Miller <Todd.Miller> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | ||
| Priority: | low | ||
| Version: | 1.8.27 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Eric Leblond
2019-02-24 02:23:59 MST
I think you can achieve what you want by running "sudo -nv". If the exit value is 0 then sudo can be run without a password. From reading the man page, this command will extend the timeout duration so we could end up in a never expiring cached authentication. Maybe the doc is wrong but when I did read the code, it did appear it was looking correct. Yes, you are correct, this won't work for your use case. Sudo 1.9.12 adds a -N flag that can be used to achieve this. For example:
sudo -Nnv >/dev/null 2&1 && echo active
will only print "active" if the user can run sudo without a password. It will not update the user's time stamp entry.
|