Rah*_*bey 1 unix filesystems shell
当我们执行ls -l命令列出目录中的文件时,是否/etc/passwd访问该文件.请解释 ??如果是,我该如何验证?
是./etc/passwd用于将用户ID映射到用户名.我们可以通过使用来关闭-n它,它将向我们显示数字用户ID和组ID(uids,gids):
$ ls -l
total 0
-rw-rw-r-- 1 thomas thomas 0 Sep 30 10:54 bar
$ ls -n
total 0
-rw-rw-r-- 1 1000 1000 0 Sep 30 10:54 bar
Run Code Online (Sandbox Code Playgroud)
终极证据:
$ strace ls -l 2>&1 | grep /etc/passwd
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
$ strace ls -n 2>&1 | grep /etc/passwd
# no output
Run Code Online (Sandbox Code Playgroud)