当使用 sudo 运行命令时,即使像 这样的简单命令也总是需要大约 4 或 5 秒才能运行echo test
。
我正在运行 rhel 9。
在查看了其他一些问题后,我运行了sudo strace -t -f sudo echo
。执行此操作时,我得到了以下信息,我猜测这是问题所在,但不确定是什么原因造成的。
[pid 318837] 17:15:24 close(11) = 0
[pid 318837] 17:15:24 prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=512*1024, rlim_max=512*1024}) = 0
[pid 318837] 17:15:24 close(65535) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:24 close(65534) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:24 close(65533) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:24 close(65532) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:24 close(65531) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:24 close(65530) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:24 close(65529) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:24 close(65528) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:24 close(65527) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:24 close(65526) = -1 EBADF (Bad file descriptor)
# this continues counting down by 1 each time
[pid 318837] 17:15:26 close(14) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:26 close(13) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:26 close(12) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:26 close(11) = -1 EBADF (Bad file descriptor)
[pid 318837] 17:15:26 close(10) = 0
[pid 318837] 17:15:26 close(9) = 0
[pid 318837] 17:15:26 close(8) = 0
[pid 318837] 17:15:26 close(7) = 0
[pid 318837] 17:15:26 close(6) = 0
[pid 318837] 17:15:26 close(5) = 0
[pid 318837] 17:15:26 close(4) = 0
[pid 318837] 17:15:26 close(3) = 0
[pid 318837] 17:15:26 geteuid() = 0
[pid 318837] 17:15:26 setuid(0) = 0