最近(自 2017-05-09 星期二 15:40:28 EDT 重启以来?),当我通过CtrlAltT或终端窗口CtrlShiftT(gnome-terminal
,LightDM)打开终端时,我看到的第一段文本是:
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
此消息来自/etc/bash.bashrc
,source
由 制作/etc/profile
。它是有条件生成的:
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
但是,我的$HOME/.sudo_as_admin_successful
存在,并且自 11 月 15 日起:
$ ll .sudo_as_admin_successful
-rw------- 1 w3 walt 0 Nov 15 2016 .sudo_as_admin_successful
并groups
说我参加了walt root adm tty lp mail dialout cdrom sudo dip video plugdev lpadmin sambashare wireshark libvirtd
(注意sudo
)。
更详细地,回应评论(我没有以“另一个用户”身份登录
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
我为什么会收到这条消息?我查看了这个答案,但似乎不适用。