Yellow background/black text ls output

Here is what I have for ls output in my Volumes dir ...

ls output

Going from the info found here ...

What do the different colors mean in ls?

it seems its "file that is setgid (g+s)". However, I do not know what that means? What are the implications of this? Also, why is the other external hdd not the same? Is there a way to change it to normal? Also, in the second column it seems that both hdds have 24 and 23 links to them. Is this normal? Thank you.


Solution 1:

Those colors indicate that you are in a directory that's writable by others and the sticky bit isn't set. This is defined by the attributes in the first column: drwxrwxrwx

What this is telling you is that it's a directory, the user, group, and others all have read, write, and execute permissions on the file. This would be the equivalent of issuing chmod 777 on that directory

In the other volume (WDred) it has the attributes drwxrwxr-x which means it's a directory, the user and group have read, write and execute rights while others can only read and execute (no write permissions). This is the equivlant of chmod 775.

Permission Attributes

The first character is is the type

-    regular file
d    directory
l    symbolic link
n    network file
s    socket

The next nine characters are the permissions for, in order by groups of three, owner, group, others

r    Permission to read file
w    Permission to write to file
x    Permission to execute file
a    Archive bit is on (file has not been backed up)
c    Compressed file
s    System file
h    Hidden file
t    Temporary file

Colorized output

The color you are seeing is not indicative of the permissions set in the system - it's a customization you control to help you identify things.

You must "ask" for colorized output with the command ls -G (my ls has been aliased to be ls -laGh meaning list, all, color, human readable).

Next and optionally, you must specify your colors in an environment variable LSCOLORS which would look something like this

export LSCOLORS="exfxcxdxcxegedabagacad"

Each attribute has a pair of letters; the first one being directory. The first pair is directory foreground and directory background. ex would be blue with the default background.

There's an excellent LSCOLOR Generator to see what the colors look like "live"

For a full description of what the colors are and how they are tied to attributes view the man page for ls (man ls) and look for the LSCOLORS section.