2

On opening a new xterminal or starting bash in an already running bash, I get a surprising error message 2 times:

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

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

Since I don't invoke bash with sudo, I ask myself, where this might come from.

First suspect is of course ~/.bashrc, where I often add small functions, but grep su ~/.bashrc only reveals words containing 'su' like success and support, all of them in comments.

So I used bash -v to invoke bash in a verbose fashion.

This showed me a lot of commands, directly or indirectly triggered from .bashrc, and between the lines this:

# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
    case " $(groups) " in *\ admin\ *|*\ sudo\ *)
    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
groups
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

except from the 3 lines after fi, this is found in /etc/bash.bashrc

Ok. That's looking for a magic file .sudo_as_admin_successful . I remembered a command

 find -empty -delete 

Issued few hours ago, but in the home directory, not where it should have been issued, but empty files - who cares?

Well, now I care.

I created a new one:

t201:~ > touch .sudo_as_admin_successful 
t201:~ > bash
t201:~ > 

Error is gone. Do I need special permissions on that file? And what is .hushlogin? I don't have this either.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.