in reply to perl file status and sudo

Maybe. For general things, that depends on your OS. Some OSses can give users roles, and you really fine-tune, which system calls may be executed by whom.

To give read only access one some file to some people, one can use ACLs, which is implemented on many OSses. To check if a file exists, one would have to be given read/exec access to the directory. And you need read access to the file to determine whether it's a file, or something else.

If it comes to -x and frieds, ACLs aren't going to help you, as they look at the permission bits.

Now, for the given problem, I don't understand why you need more than read-only rights. All you need for -f and -e is read only access anyway.

Replies are listed 'Best First'.
Re^2: perl file status and sudo
by Saved (Beadle) on Mar 22, 2012 at 13:13 UTC

    Thank You. We use HP-UX and RHEL linux. I do not need more than read-only access. I just would like to use perl only, and not bounce to the shell if not required.

      I'm confused. Are you saying you can do if [ -f file ] in the shell, but not if (-f "file") from a Perl program?

        The issue is, I have been told by in-house staff that is is not possible in sudo. I though someone might know if it is, or if there is an alternate.

        -f or -e work fine in my perl as me, but I need to ascertain the existence of files I do not have standard *NX access to, so I need something like sudo.