I have been following this thread but I am still a little
confused about the best procedure to use to check file
permissions. For example, lets say you have an application
that is owned by root but does NOT have the set user ID or
set group ID bits set. What is the correct procedure to
check if a file:
(1) exists
(2) user has read access
(3) user has write access
Obvious, the open() command will determine if a file has the
right permissions. But, in my case, I do not need to open
the file ( it will be open by another application ). Is
it possible to duplicate the file access test performed
by the open() command without using the open() command? The
access() command test accessibility based on the real user
ID and the real group ID which is not how the open()
command works.(it uses the effective user ID). Plus, it
has been mentioned in this thread that it should not be
used. So it appears that access() is not the best solution.
How about the stat() command? Should I just give up and use
the open() to check if the has the right permissions since
it is the final authority? An example would be appreciated.
How is the permission check effected by the su program. If
user Joe logs on and then su over to Bob and executes my
program will the file checks use Bob or Joe ID?
I am using a Silicon Graphics workstation running IRIX 4.0.5.
Thanks for the help,
John Chauvin
Cerritos, California
--
Netcom - Online Communication Services San Jose, CA