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?

1
  • 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, 2011 at 15:41

4 Answers 4

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

4
  • 23
    Is there a way to remove this functionality completely?
    – nwalke
    Apr 18, 2014 at 8:11
  • 1
    It is just a test and a message to say "did you know, you can use sudo to run commands as admin".
    – HankCa
    Oct 26, 2016 at 0:31
  • I realized about the message once I deleted that file one day, for no reason. thanks
    – Nestor
    Aug 26, 2021 at 22:59
  • @nwalke: See this answer: askubuntu.com/a/22646/405408 Oct 16, 2021 at 7:37
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".

2
  • 1
    I was wondering where it was coming from, and this answers it. Thanks!
    – mouche
    Jan 26, 2011 at 6: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, 2020 at 9: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.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .