Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've developed a bad habit of constantly sudoing to root. I was wondering if its possible to create an alias that prevents straight sudo but allows sudo -u. Or possibly echoes a warning when using sudo?

share|improve this question

closed as not constructive by MDMarra, John Gardeniers, Magellan, MadHatter, Scott Pack Nov 27 '12 at 13:48

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Why not just fix your bad habits? – John Gardeniers Nov 27 '12 at 6:14

This is a people problem, but...

By default sudo gives a warning when asking for your password ("with great power comes great responsibility etc etc")

You can use a custom sudo lecture file to setup a custom warning.

In /etc/sudoers

Defaults lecture_file=/home/user/lecture lecture=always

share|improve this answer

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