What is a good way of checking to see if a particular user may access a particular file?

Posted by Rising Star on Stack Overflow See other posts from Stack Overflow or by Rising Star
Published on 2010-05-11T21:08:02Z Indexed on 2010/05/11 21:24 UTC
Read the original article Hit count: 226

I am working on application which runs as a special unprivileged user. I would like to be able to easily check to see if the user can read a given file. It seems like this should be easy, even when I go into the file in Windows Explorer and see that the read permission is checked, it sometimes seems that there is still something preventing the user from reading the file (such as a parent directory that the user cannot browse) when I try to read it as the user programmatically.

The user has no console logon permission, so I can't just log in as the user and try to read the file.

So...

If I want to know, "Does UserBob have access to file c:\specialPath\specialFile, what is an easy way to find out? BTW, my environment is Windows Server 2003.

© Stack Overflow or respective owner

Related posts about security

Related posts about windows-server-2003