On Fri, 27 Jul 2007 19:29:26 +0200 opensuse@sky-bizz.com wrote:
Hello
[at first: i am not new to developing software, but i am slightly new to developing linux-software :)]
i'm just developing an command line tool for linux (c++), which has to save its data into a single file in the filesystem, undependently from running user. its handling is best described like or compared with "updatedb". there is only one data-file for all users.
in which folder should i create the application's data-file, and whats about the needed rights on it? can this application "ask" for getting needed privileges like on windows?
is there a special folder intended for handling such things? if yes, what folder?
In Unix and Linux systems every directory (eg folder) and every file
has a set of permissions and ownerships:
Ownerships are the owner, the group, everyone else
Permissions are: read, write, execute.
The execute bit for directories means that you can enter that
directory. For regular files, it means you can execute the file. This
is different than for Windows where executable files must have specific
extensions.
Normally in Linux, user-oriented data is saved on a per-user basis, in
the user's home directory. If you want to have a global database of
information, just come up with where you want to put it. Let's saye
your application is called FuBAR. You might want to install it
in /usr/local/FuBAR where FuBAR might have subdirectories, bin - for
executables, lib for libraries, data for shared data, conf for config
files.
There are a number of ways you can have multiple users write to the
same file. One way is to use the setuid or setgid bits, but that is
dangerous.
Probably a safer way is to set up the shared data file rw by the FuBAR
group, and anyone who can use it must be in that group. There is a
command, newgrp(1) that allows a user to change to any group he is a
member of. The cvs command works similar to this so you can check files
into and out of a shared repository.
--
Jerry Feldman