Search

Making sudo give a lecture every time it is used.

sudo command needs to be used with caution and sometimes we might need make this caution obvious with a message .
There is an option in sudo using which we can inform the user about using sudo with a message every time sudo is used.

Open the file /etc/sudoers



Add the following line after the intial comments to make sudo to throw the lecture every time sudo is used by a user.



If giving lecture every time seems like an overkill, it can be made to lecture only once when a user uses the sudo for the first time.

The message that is shown by default is



Instead of the above message, we can show our own customized message by putting the message into a file. for e.g. let us put the following message



In a file called lecture ,under the folder /home/user .

To make sudo use this file for the lecture message add the following line after enabling the lecture as shown above.



Save and quit the file. The next time we use the command sudo, we should see the above message being shown.

Follow by Email