Link to home
Start Free TrialLog in
Avatar of emshelly
emshelly

asked on

allow only owner access to a file

Hi all,

I'm writing a C program that needs to be portable to different platforms (runnable in any ANSI C enviornment). I need to create a file and set the permission to only allow owner access. I don't know what functions I can use from the c runtime library to do that. And I don't know if I can use any other type of libraries. Could someone give me some suggestions?

Thanks a lot!
Michelle
SOLUTION
Avatar of gj62
gj62

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of grg99
grg99

Many operating systems don't have even the concept of "owner"-- like PCDOS, Win95/98/Me.

If your program has to run on these systems, you're going to have to make your own user-level security.

This means you'll have to set up your own username/password file and have your program look up users before granting access to the file.

*Or* you could encrypt the file with a key of the user's choosing, which has its own advantages and disadvantages.

It's not a trivial thing, but not too hard to do.  I guess too it depends on exactly how secure these files have to be.

Avatar of emshelly

ASKER

Currently the application is for Linux and Solaris. Later it will need to also support Windows. Thanks for all your help! They are all helpful. Is it possible to award points to more than one person?

=)
By the way, do you guys know how to make the file invisible?

Thanks again!
Nothing has happened on this question in over 10 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
split points between gj62 and jkr.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer