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.
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
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
|
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.
Edited and reformatted 10/2005
Butchu, 12 October 2007
Thanks for taking the time to make this clear!
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 :)