[TriLUG] Yet another c++ question
Rick DeNatale
rick.denatale at gmail.com
Tue Nov 15 11:43:27 EST 2005
On 11/15/05, Mark Freeze <mfreeze at gmail.com> wrote:
> I know Linux doesn't have a registry so I am looking for a more secure
> way of keeping track of this value other than just writing it to a
> file somewhere on the disk. If writing this value to a file is the
> only way to keep track of it, what are some methods that I could
> employ to secure the file so that it is not deleted, lost,
> overwritten, or tampered with but still remains open enough where any
> user could run the program?
1) Institute a backup regimen, you should do this anyway. Look at the
trilug web page for the notes of a talk which Jeremy Portzer and Jason
Tower did a year or so ago on backup. I use a combination of an rsync
based backup system based on info of that talk to backup my main
server, and backuppc to backup up other machines on my home network to
that server.
2) In posix systems, permissions are your friend. if you want to
protect against arbitrary folks writing to the file, you can assign
write access to a single user or group, then arrange for this user to
update it. One idea might be to write a daemon which assigns the ids
and have your application talk to it via a pipe. There may well be
existing programs which will do this.
3) As to where to keep the file, somewhere under /var is probably
good, make a directory /var/yourAppName for example.
Of course most, if not all RDBs will have facilities for generating
unique keys which would do away with the problem.
--
Rick DeNatale
Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/
More information about the TriLUG
mailing list