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 source
d 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.
.hushlogin
? That file needs to exist too apparently. I have no mention of it in my.bashrc
– Zanna May 21 '17 at 05:41sudo
, it's just a message telling you that you can. The assumption in question title is incorrect. – gronostaj May 21 '17 at 07:56-rw-r--r-- 1 mook mook 0 Nov 21 02:49 .sudo_as_admin_successful
– mook765 May 21 '17 at 17:59PS4='${BASH_SOURCE}:${LINENO} ' bash -x
and add the output, please. – muru May 21 '17 at 18:45bash -x
does NOT reproduce the problem. The emitter of the problem text (/etc/bash.bashrc
) is sourced long before I could setPS4
(nice trick, though). I could temporarily setPS4
in/etc/profile
(very carefully), I suppose. – waltinator May 21 '17 at 20:02/etc/profile
is irrelevant unless you're running a login shell, which gnome terminal doesn't, by default – muru May 21 '17 at 20:05/etc/bash.bashrc
, which is ONLY AFAIK called from/etc/profile
, and my gnome-terminal Default preferences do not have "Run command as a login shell" checked, is my Q really "Why is gnome-terminal` starting everything as a login shell"? – waltinator May 21 '17 at 20:17If Bash is started with the effective user (group) id not equal to the real user (group) id, and the -p option is not supplied, no startup files are read, shell functions are not inherited from the environment, the SHELLOPTS, BASHOPTS, CDPATH, and GLOBIGNORE variables, if they appear in the environment, are ignored, and the effective user id is set to the real user id. If the -p option is supplied at invocation, the startup behavior is the same, but the effective user id is not reset
Found at https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html#Bash-Startup-Files – mook765 May 21 '17 at 22:09/etc/profile
->/etc/bash.bashrc
(message),$HOME/.bashrc
) ARE executed, and I haven't changed anything group-related since Nov 15 (addedepmd
group), I'm confused on how your comment applies. – waltinator May 22 '17 at 03:55/etc/ bash.bashrc
. Does a file/home/walt/.sudo_as_ad...
exist? If not, you could create it, just to track the problem. This is really a hard nut! – mook765 May 22 '17 at 06:19HOME
is a variable and it's value could change. To see the value ofHOME
at the moment/etc/bash.bashrc
is running you could add the lineecho "$HOME"
just above the provided snippet of the file. After adding this line open a new terminal and you will see in which directorybash.bashrc
is looking for the files.sudo_as_admin_successful
and.hushlogin
. I think this will give us a clue. – mook765 May 22 '17 at 14:27/etc/profile
, I started anothergnome-terminal
(Ctrl-Alt-T
) which did NOT exhibit the problem. More thought is needed - one of my long-ago implemented self-watching hacks told me that, in the badgnome-terminal
I had 10 env vars, and in the good one, 65. – waltinator May 23 '17 at 05:07.profile
and.bashrc
aside, I found that thegnome-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
. NoHOME
! This is a bug report, not an AskUbuntu Q, I think. – waltinator May 25 '17 at 20:02JournalError.txt
:dev-disk-by\x2duuid-0123\x2d4567.device: Dev dev-disk-by\x2duuid-0123\x2d4567.device appeared twice with different sysfs paths
. I think that is not related to the problem but maybe something you should look at. There are also several errors aboutpam_ecryptfs: seteuid error
, that could probably be a point. But that's above my horizon, I will follow your bug-report with interest. – mook765 May 27 '17 at 20:42