ls -F 或 ls -al - 红色突出显示是什么意思?

Joh*_*ann 1 linux ls security

所以我在我的目录上运行了ls -Fls -al,我的/usr/bin一些文件显示为红色背景和白色文本。这是什么意思?

在此处输入图片说明

HBr*_*ijn 6

对于 GNU 实现ls,颜色的含义取决于LS_COLORS环境变量的设置,通常使用dircolors命令设置。

数字代码(的组合)确定使用哪些颜色来指示特定文件类型:

# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white 
Run Code Online (Sandbox Code Playgroud)

红色背景上的白色文本由以下组合定义 37;41

使用echo "$LS_COLORS"进行调查,发现:
su=37;41
这样SETUID文件是白色文字,红色背景(这恰好是默认值)

dircolors --print-database 在没有任何自定义的情况下,为默认设置提供更详细和可读的输出:

SETUID 37;41 # file that is setuid (u+s)
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
Run Code Online (Sandbox Code Playgroud)

对于设置了粘性位的目录,红色突出显示的唯一其他默认用法是红色背景上的蓝色文本