ZoneO-tips for Mandriva Linux

Changing default permissions

It seems that all files created in a Mandriva distribution are world-readable, but I don't like that! How do I change the default file permissions in Mandriva?

 
 

Well, by default, the permissions of files created with Mandrake are

-rw-r--r--
that is
  • the owner can read, and overwrite it,
  • the users who are member of the same group than the owen can read it,
  • the other users can read it as well.
How do you know this? Well, type ls -l in a shell (or konsole). In graphical mode (konqueror for instance), right-click on the file, click on properties in the menu, and then choose the permission tab.

To change those permissions, you can use the command chmod, or, in graphical mode, this same permissions tab.

Now, here is the real problem. You might want the default permissions on newly created file to be:

-rw-------
which means
  • the owner can read and overwrite it,
  • the other members of the group can not do anything,
  • the outside world can not do anything.
In order to do so, you have to start the control center, then the security tab, the Levels and checks icon, the System options tab... and change the value on the the last line: User umask. In my case, I had to change it to 066...

Why 066? Well, it would take me hours to explain this, so I'll just give a few links:

Good luck!

And if you need a little help for all those unix commands, I really recommend the book Unix in a Nutshell. It's really good, with a nice summary of the most important Unix commands, shell references, and all those things you keep forgetting about sed, regular expressions, or vi.

01/2005
Edited and reformatted 10/2005
 

Nex, 11 October 2007

"Why 066? Well, it would take me hours to explain this"

Hours? It's simple.

You just substract logical sum from 666 (rw-rw-rw-) for files and from 777 (rwxrwxrwx) for catalogs.

Default umask for every user is 022, so 666 - 022 = 644 (rw-r--r--).

Your example: 666 - 066 is 600 (rw-------). If you want to have a catalog rwx---r-x you set umask 072, because:

777 - 072 = 705 (rwx---r-x). It's simple :)

Butchu, 12 October 2007

Thanks for taking the time to make this clear!

Add a comment

Name:
Email or URL: (optional)
Security code
Code shown above:
 
 
© ZoneO-soft - Contact us - Start page