126

Whenever I open the terminal,

To run a command as administrator (user "root"), use "sudo <command>".  
See "man sudo_root" for details.

appears before the terminal. How do I get that to go away?

Isaiah
  • 59,344
mouche
  • 1,487
  • Interesting. I once saw such a thing, but never on terminal I open myself. How would I get that back if I wanted it? – MPi Jan 21 '11 at 15:41

4 Answers4

173

Once you run a sudo command, the file ~/.sudo_as_admin_successful will be created and the warning will go away. So either run a sudo command, such as sudo apt-get update or create the ~/.sudo_as_admin_successful file manually:

touch ~/.sudo_as_admin_successful

If you want the warning back for whatever reason, remove ~/.sudo_as_admin_successful:

rm ~/.sudo_as_admin_successful

If you want to remove this functionality completely, then see answer above: https://askubuntu.com/a/22646/405408. In short: remove this message from /etc/bash.bashrc

Eugen Konkov
  • 796
  • 9
  • 18
Isaiah
  • 59,344
45

Maverick? Comment it out: sudo vim /etc/bash.bashrc. The section, commented:

# sudo hint
# if [ ! -e "$HOME/.sudo_as_admin_successful" ]; then
#     case " $(groups) " in *\ admin\ *)
#     if [ -x /usr/bin/sudo ]; then
#     cat <<-EOF
#     To run a command as administrator (user "root"), use "sudo <command>".
#     See "man sudo_root" for details.
#    
#     EOF
#     fi
#     esac
# fi

Finding the file to start:

$ sudo grep -R "man sudo_root" /etc

The result:

/etc/bash.bashrc:   See "man sudo_root" for details.

and then scroll though the output until you see which file contains "man sudo_root".

antivirtel
  • 3,645
  • 1
    I was wondering where it was coming from, and this answers it. Thanks! – mouche Jan 26 '11 at 06:06
  • @user8290 It doesn't work in Ubuntu 20.04 LTS. I commented out just like you mentioned, save the file, open the terminal, ran "sudo apt update", went to home folder and saw .sudo_as_admin_successful file. #Bummer I wish what you said actually worked. – Pranav Jul 15 '20 at 09:12
5

This should not happen, unless you did not yet run any command using sudo (sudo echo "hello" should be enough).

If you did run a command using sudo and you don't see the file ~/.sudo_as_admin_successful, then you are probably hit by this bug.

htorque
  • 64,798
0

By the way, touch-ing ~/.hushlogin could also be used to disable the behavior.

mathway
  • 1,694