0

I am beginning with the mount and Linux file-system concept. Just as a simple test I have mounted a share from my server(VM) to the client (VM). Things are fine, it is mounted and I could work on it as on a local file system.

And then I tried mounting a share from my physical machine to my client(VM), things are also went fine. But the place where I have been stuck is when I see the color of the shares that I have mounted. Share that mounted from VM to VM is in green and the one I have mounted from physical to VM is look like a normal directory. I haven't used any special option switches while mounting. I wonder what this all about the color thing when mounting, can anyone shed some light?[my distro is debian]

screen shot

As you could see 173_VM is file share mounted from VM and next is file-share mounted from physical machine. The VM one is in green.

countermode
  • 7,533
  • 5
  • 31
  • 58
RaGa__M
  • 169

4 Answers4

1

I assume that you are using ls which is coloring the directories/files.

ls colors directories and files based off what they are what permissions they have, it does not care about mount points. It is likely that the permissions are different for the different ways you have mounted the remote shares. Use ls -l to see what permissions, as well as other information, the directories have.

The actual coloring depends on what version of ls and what color schemes you have on your terminal but for me a green background indicates that a folder has world writable permissions (ie anyone can write to the folder):

<code>ls -l</code> output

1

In this case, The green colouring is displayed due to the "sticky bit" being set on the directory. This is denoted by the "t" in the permissions (notice that the other one doesn't have the t).

This essentially just means that the directory is writable by all users on the system but only the owner of a file within can delete/rename it to prevent accidental destruction.

For more in depth information on sticky bits here is a comprehensive explanation.

1

To begin with, the coloring in the output of ls is configurable (by way of the environment variable LS_COLORS, see this answer on ls coloring). Now, the green color in the figure for 173_VM is due to the sticky bit set which you can see by the t to the right in the first field.

Try this:

ls -ld /tmp

and if you haven't meddled with LS_COLORS (or the permissions of /tmp), then /tmp should be displayed green as well.

Likewise:

mkdir -m 1777 xyz
ls -ld xyz

Anyway, the odd permissions strike me: --S--Srwt is octal 7007, and that doesn't make sense altogether.

countermode
  • 7,533
  • 5
  • 31
  • 58
0

I wonder what this all about the color thing when mounting, can anyone shed some light?

The colors of ls can represent the permissions, the defaults for some systems is to show directories where everyone has write permissions with a green background:

You can change the default color as bellow:

Export the directory colors database:

dircolors --print-database > ~/.mydircolors

Open it with your favorite editor (nano ~/.mydircolors),Modify or add the missing file extension as you like, then open your .bashrc:

Comment out the following lines, to get:

# You may uncomment the following lines if you want `ls' to be colorized:
 export LS_OPTIONS='--color=auto'
 eval "`dircolors`"
 alias ls='ls $LS_OPTIONS'
 alias ll='ls $LS_OPTIONS -l'
 alias l='ls $LS_OPTIONS -lA'

Modify eval "dircolors" to :

eval "`dircolors ~/.mydircolors`"

Save and exit.

GAD3R
  • 66,769