3

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.

  • First off, you are looking at the color designation for Linux, not FreeBSD/macOS. See this relevant post: apple.stackexchange.com/a/282189/119271 Secondly, can you execute the command echo $LSCOLORS to see if anything has been customized on your end. – Allan Dec 29 '17 at 10:05
4

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.

| improve this answer | |
  • Thanks. I thought it had something to do with permissions. I am reading up on setuid/setgid permissions right now. Do you think it's a good idea to have setgid permissions enabled on my external hdds? What permissions would be the best/most safe? I think I may have changed the permissions when I was trying to set up my drives to be shared over the network through my RPi. I had set up a samba server and the drives would show up on my mac and I could access the files, but not write to the drives. I think in trying to gain write access I changed the permissions. Though I'm not sure. :D – m147 Dec 29 '17 at 10:30
  • There is no "best" for permissions. It's what works best for your scenario. In some instances you want everyone to have access (chmod 777) and in other situations you only want to have the user and nobody else have to have just read/write permissions (chmod 600). In some cases, like if your drive is formatted NTFS (shared with Windows) you have no choice and write permissions are defaulted to "no" for everyone. – Allan Dec 29 '17 at 10:48
  • Ok thank you. That helped understand this a little more. I think what I'll do it remove the setgid permission on the drive. reading here: techrepublic.com/blog/it-security/… it seems there is no reason to have it set for general use – m147 Dec 29 '17 at 11:05
  • it seems there is no reason to have it set for general use -- Exactly. – Allan Dec 29 '17 at 11:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .