Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Usually, when I run sudo, it will ask me to enter a password the first time and it will remember that I'm authenticated for the next few minutes, until that authentication times out.

This leaves a hole in the system's security. Coupled with a bit of social engineering, a malicious shell-script/Makefile/etc. could run sudo inside it and gain access to root.

Without giving up the convenience of the "remember authentication" feature, I would still like to have a more secure setup. Is there a way to set up sudo to only remember authentication for the pid that authenticated successfully, or something similar? I know that you can configure sudo to ask for authentication every time, but I'm thinking of something that doesn't forgo the convenience for the security.

share|improve this question
add comment

2 Answers

You could use sudo -K before running anything you don’t trust.

share|improve this answer
add comment

The closest you could come to this would be to rename the sudo command to a name that the attackers do not know. Yes, this is security by obscurity, but if you can invoke sudo then a script running as you can invoke it (if it knows its name).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.