Opening terminal asks for sudo password

Whenever I open a new terminal within 12.04, I am prompted to enter my sudo password.

Why is this happening?


Solution 1:

Check your .bashrc file in your home directory. Sometimes it contains some sudo commands.

More info:

Open a terminal and press Ctrl+C when asked for the password. Then, to validate it's .bashrc causing the issue you can run

$ source ~/.bashrc

Just make sure you did not previously ran any sudo commands so the password is not active.

If it asks for a password than something inside it or files included by it contain sudo commands.

I had this issue when I added an alias on my dev machine

alias clearphpsessions="cd /var/lib/php/sessions && sudo rm $(sudo ls /var/lib/php/sessions) && cd -"

Seems like the $(sudo ls /var/lib/php/sessions) part was interpreted, hence required the sudo password.