4

Recently (since the reboot at Tue 2017-05-09 15:40:28 EDT?), when I open a terminal via CtrlAltT, or a terminal window CtrlShiftT (gnome-terminal,LightDM), the first text I see is:

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

This message is coming from /etc/bash.bashrc, which is sourced by /etc/profile. It's generated conditionally:

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

But, my $HOME/.sudo_as_admin_successful exists, and has since Nov 15:

$ ll .sudo_as_admin_successful
-rw------- 1 w3 walt 0 Nov 15  2016 .sudo_as_admin_successful

and groups says I'm in walt root adm tty lp mail dialout cdrom sudo dip video plugdev lpadmin sambashare wireshark libvirtd (Note sudo).

More detail, in response to comments (I'm not logged in as "another user"

w3@aardvark:~(0)$ id
uid=1003(w3) gid=1000(walt) groups=1000(walt),0(root),4(adm),5(tty),7(lp),8(mail),20(dialout),24(cdrom),27(sudo),30(dip),44(video),46(plugdev),109(lpadmin),124(sambashare),149(wireshark),152(libvirtd)
w3@aardvark:~(0)$ pathlld $HOME/.sudo_as_admin_successful
drwxr-xr-x 29 root root 4096 May 18 20:46 /
/dev/sdb5 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
drwxr-xr-x 13 root root 4096 Sep  1  2015 /home
/dev/sdb6 on /home type ext4 (rw,relatime,data=ordered)
drwx------ 191 w3 walt 147456 May 21 01:38 /home/w3
/home/.ecryptfs/w3/.Private on /home/w3 type ecryptfs (rw,nosuid,nodev,relatime,ecryptfs_fnek_sig=e377cfa845240aa1,ecryptfs_sig=5fa903fe1f605483,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs)
-rw------- 1 w3 walt 0 Nov 15  2016 /home/w3/.sudo_as_admin_successful

Why am I getting this message? I've looked at this answer, but it doesn't seem to apply.

  • 1
    What's .hushlogin? That file needs to exist too apparently. I have no mention of it in my .bashrc – Zanna May 21 '17 at 5:41
  • 1
    Just an idea... What is the value of $HOME ? You are probably logged in as another user? – mook765 May 21 '17 at 17:35
  • 1
    Another idea: in my case I have the following ownership and permissions -rw-r--r-- 1 mook mook 0 Nov 21 02:49 .sudo_as_admin_successful – mook765 May 21 '17 at 17:59
  • 2
    @Zanna no, the file doesn't need to exit - the presence of either file is enough. ((NOT fileA) AND (NOT fileB)) == (NOT (fileA OR fileB)). waltinator: Run PS4='${BASH_SOURCE}:${LINENO} ' bash -x and add the output, please. – muru May 21 '17 at 18:45
  • 1
    After moving my .profile and .bashrc aside, I found that the gnome-terminal that complains was started with an environment consisting ONLY of: DISPLAY=:0,PWD=/home/w3,SHLVL=1,TERM=xterm-256color,VTE_VERSION=4205,WINDOWID=67108874. No HOME! This is a bug report, not an AskUbuntu Q, I think. – waltinator May 25 '17 at 20:02

Browse other questions tagged or ask your own question.