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

Show sudo credential status #335

Closed
dolmen opened this issue Dec 19, 2014 · 3 comments
Closed

Show sudo credential status #335

dolmen opened this issue Dec 19, 2014 · 3 comments
Assignees
Labels
enhancement Feature request sudo Related to the detection and display of sudo permissions

Comments

@dolmen
Copy link
Collaborator

dolmen commented Dec 19, 2014

When you run sudo, the credentials may be saved by sudo for that shell. This means that any command running from that shell will be able to use those credentials. So it is safer for the user to remember to remove those credentials once he doesn't need it anymore. Liquid Prompt is a good place to signal the user that sudo credentials are active.

To check sudo credentials (returns 0 if credentials are cached, 1 if not):

sudo -n /bin/true 2> /dev/null

To expire your credentials:

sudo -K

To renew your credentials for 15 minutes:

sudo -v
@dolmen dolmen self-assigned this Dec 19, 2014
@dolmen dolmen added the enhancement Feature request label Dec 19, 2014
dolmen added a commit that referenced this issue Dec 19, 2014
Change the color of the prompt mark while 'sudo' credentials are cached.

New variables:
- LP_ENABLE_SUDO
- LP_COLOR_MARK_SUDO

#335
dolmen added a commit that referenced this issue Dec 19, 2014
@dolmen
Copy link
Collaborator Author

dolmen commented Dec 19, 2014

Implemented! Now in develop.

@dolmen dolmen closed this as completed Dec 19, 2014
@alexprengere
Copy link
Contributor

I think the liquid.ps1 file should be updated to reflect these changes as well 😉

pkkolos pushed a commit to pkkolos/liquidprompt that referenced this issue Dec 22, 2014
Change the color of the prompt mark while 'sudo' credentials are cached.

New variables:
- LP_ENABLE_SUDO
- LP_COLOR_MARK_SUDO

liquidprompt#335

Conflicts:
	default.theme
	liquidprompt
	liquidpromptrc
@jsuter1
Copy link

jsuter1 commented Jan 20, 2015

Can LP_ENABLE_SUDO be changed to default to 0? If the user is not permitted to run sudo commands, it will trigger a sudo event:
Jan 20 15:30:25 xxxx sudo: xxxx : user NOT in sudoers ; TTY=pts/57 ; PWD=/home/xxxx ; USER=root ; COMMAND=/bin/true

I had a customer trigger 50+ sudo alerts over the course of the day due to this.

@dolmen dolmen added the sudo Related to the detection and display of sudo permissions label Jan 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request sudo Related to the detection and display of sudo permissions
Projects
None yet
Development

No branches or pull requests

3 participants