Quote:
Originally Posted by Ramurd
so, you store: unique directory names, unique filenames and unique machines... Now one thing often leads to another... why search and store the files of only one machine?
|
I just can't resist, sorry..
If you use my suggestion, you could create a third program, a collator, which reads in the databases from each machine, and combines them into one huge one (incrementally or atomically replacing the old one). Then you need a simple service daemon, which responds to queries from TCP/IP, and queries the central database. In this case, you can set the machine name as a "virtual" directory name, so that each path begins with the machine name.
There are some privacy issues, though. Should there be limits on which users can see which files? What if the user has a private directory, say
pr0n, which is only accessible to that user. Should other users see the filenames in there or not?
On a single machine you can most easily handle the privacy issues simply by checking if the file or directory is visible to the querying user. See man 2
access, man 2
stat, and man 7
credentials for further info.
When you have a network of multiple machines, the values of
uid and
gid are useless. They are have meaning only locally on that single machine. For example, if you are using Ubuntu, your UID is quite likely 1000. This means that the privacy measures that are easy to apply on a single machine, are quite difficult to solve in a networked environment.
The only possibility I know of is to create a mapping between
uids on each machine (and the same for
gids as well); perhaps via user and group names. This is kludgy, and does not always work that well, but I don't know of any better way.
(Okay, there is another: when possible matches are found, have the user log in to the target machine, and do the checks locally. But I don't think this would be quite sane.)