在关闭互联网的情况下在终端中运行此命令:
while true;do sudo -n uptime 2>/dev/null;echo "`date`($((i++)))";sleep 0.1;done
现在打开互联网(这里是WIFI)。
现在日志每 5 到 10 秒就会发生一次......
如何让 sudo 忽略网络?
另外,为什么它会有这样的表现?
观测:ubuntu 22.04
PS.:我用来sudo -n uptime
警告终端是否具有 sudo 访问权限(我将其全部涂成红色)。所以我在终端中运行的每个命令都会遇到这个问题。
WIFI开启时的延迟日志:
Fri 5 Jan 00:07:41 -03 2024(0)
Fri 5 Jan 00:07:47 -03 2024(1)
Fri 5 Jan 00:07:52 -03 2024(2)
Fri 5 Jan 00:07:57 -03 2024(3)
Fri 5 Jan 00:07:57 -03 2024(4)
Fri 5 Jan 00:08:02 -03 2024(5)
Fri 5 Jan 00:08:02 -03 2024(6)
Fri 5 Jan 00:08:13 -03 2024(7)
Fri 5 Jan 00:08:18 -03 2024(8)
Fri 5 Jan 00:08:18 -03 2024(9)
Fri 5 Jan 00:08:23 -03 2024(10)
Fri 5 Jan 00:08:28 -03 2024(11)
Fri 5 Jan 00:08:28 -03 2024(12)
Fri 5 Jan 00:08:34 -03 2024(13)
Fri 5 Jan 00:08:39 -03 2024(14)
Fri 5 Jan 00:08:44 -03 2024(15)
Fri 5 Jan 00:08:44 -03 2024(16)
当 WIFI 关闭时:
Fri 5 Jan 00:11:45 -03 2024(21)
Fri 5 Jan 00:11:45 -03 2024(22)
Fri 5 Jan 00:11:46 -03 2024(23)
Fri 5 Jan 00:11:46 -03 2024(24)
Fri 5 Jan 00:11:46 -03 2024(25)
Fri 5 Jan 00:11:46 -03 2024(26)
Fri 5 Jan 00:11:46 -03 2024(27)
Fri 5 Jan 00:11:46 -03 2024(28)
Fri 5 Jan 00:11:46 -03 2024(29)
Fri 5 Jan 00:11:46 -03 2024(30)
Fri 5 Jan 00:11:47 -03 2024(31)
Fri 5 Jan 00:11:47 -03 2024(32)
Fri 5 Jan 00:11:47 -03 2024(33)
Fri 5 Jan 00:11:47 -03 2024(34)
Fri 5 Jan 00:11:47 -03 2024(35)
Fri 5 Jan 00:11:47 -03 2024(36)
Fri 5 Jan 00:11:47 -03 2024(37)
Fri 5 Jan 00:11:47 -03 2024(38)
Fri 5 Jan 00:11:47 -03 2024(39)
Fri 5 Jan 00:11:48 -03 2024(40)
Fri 5 Jan 00:11:48 -03 2024(41)
Fri 5 Jan 00:11:48 -03 2024(42)
Fri 5 Jan 00:11:48 -03 2024(43)
Fri 5 Jan 00:11:48 -03 2024(44)
Fri 5 Jan 00:11:48 -03 2024(45)
Fri 5 Jan 00:11:48 -03 2024(46)
Fri 5 Jan 00:11:48 -03 2024(47)
Fri 5 Jan 00:11:49 -03 2024(48)
Fri 5 Jan 00:11:49 -03 2024(49)
Fri 5 Jan 00:11:49 -03 2024(50)
Fri 5 Jan 00:11:49 -03 2024(51)
Fri 5 Jan 00:11:49 -03 2024(52)
Fri 5 Jan 00:11:49 -03 2024(53)
Fri 5 Jan 00:11:49 -03 2024(54)
Fri 5 Jan 00:11:49 -03 2024(55)
Fri 5 Jan 00:11:50 -03 2024(56)
Fri 5 Jan 00:11:50 -03 2024(57)
Fri 5 Jan 00:11:50 -03 2024(58)
Fri 5 Jan 00:11:50 -03 2024(59)
Fri 5 Jan 00:11:50 -03 2024(60)
Fri 5 Jan 00:11:50 -03 2024(61)
Fri 5 Jan 00:11:50 -03 2024(62)
Fri 5 Jan 00:11:50 -03 2024(63)
Fri 5 Jan 00:11:50 -03 2024(64)
Fri 5 Jan 00:11:51 -03 2024(65)
Fri 5 Jan 00:11:51 -03 2024(66)
Fri 5 Jan 00:11:51 -03 2024(67)
Fri 5 Jan 00:11:51 -03 2024(68)
Fri 5 Jan 00:11:51 -03 2024(69)
Fri 5 Jan 00:11:51 -03 2024(70)
Fri 5 Jan 00:11:51 -03 2024(71)
Fri 5 Jan 00:11:51 -03 2024(72)
Fri 5 Jan 00:11:52 -03 2024(73)
Fri 5 Jan 00:11:52 -03 2024(74)
Fri 5 Jan 00:11:52 -03 2024(75)
Fri 5 Jan 00:11:52 -03 2024(76)
Fri 5 Jan 00:11:52 -03 2024(77)
Fri 5 Jan 00:11:52 -03 2024(78)
Fri 5 Jan 00:11:52 -03 2024(79)
Fri 5 Jan 00:11:52 -03 2024(80)
Fri 5 Jan 00:11:52 -03 2024(81)
Fri 5 Jan 00:11:53 -03 2024(82)
Fri 5 Jan 00:11:53 -03 2024(83)
Fri 5 Jan 00:11:53 -03 2024(84)
Fri 5 Jan 00:11:53 -03 2024(85)
Fri 5 Jan 00:11:53 -03 2024(86)
Fri 5 Jan 00:11:53 -03 2024(87)
Fri 5 Jan 00:11:53 -03 2024(88)
Fri 5 Jan 00:11:53 -03 2024(89)
Fri 5 Jan 00:11:54 -03 2024(90)
Fri 5 Jan 00:11:54 -03 2024(91)
Fri 5 Jan 00:11:54 -03 2024(92)
Fri 5 Jan 00:11:54 -03 2024(93)
Fri 5 Jan 00:11:54 -03 2024(94)
Fri 5 Jan 00:11:54 -03 2024(95)
Fri 5 Jan 00:11:54 -03 2024(96)
Fri 5 Jan 00:11:54 -03 2024(97)
Fri 5 Jan 00:11:54 -03 2024(98)
Fri 5 Jan 00:11:55 -03 2024(99)