Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
    
Why not just fix your bad habits? –  John Gardeniers Nov 27 '12 at 6:14
add comment

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.

1 Answer

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
add comment

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