in reply to Re^4: perl file status and sudo
in thread perl file status and sudo

*What* isn't possible in sudo?

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

    Giving perl -e $FILE or -f $FILE the ability to return the correct status of files that I, as a standard user do not have access to. As Security, I am allowed to see anything, but change nothing, and so as my standard user, am told files do not exist that really do.

      sudo is used to give people the right to run a specific command as a different user -- it doesn't control the rights inside some other program. (Given that you're in "security", I would assume you knew this).
      As Security, I am allowed to see anything, but change nothing
      If you're allowed to "see anything", why do you think you need special permission to see if a file exists? Do you know what "anything" means? Perhaps you use a different meaning that the rest of the world?
      and so as my standard user, am told files do not exist that really do.
      Are you sure noone is trying to pull you a leg? "Files that do not exist that really do" sound like a prank -- like what they try to pull on newbies in a woodshop: sending them on an errand to get a square hole drill.

        I think he means situations where he is denied read access to a directory:

        $ echo $EUID 1000 $ ls -ld /var/log/apache2 drwxr-x--- 2 root adm 12288 Mar 18 06:25 /var/log/apache2 $ ls -l /var/log/apache2 ls: cannot open directory /var/log/apache2: Permission denied $ perl -E 'say ((-e q-/var/log/apache2/access.log-) ? "exists" : "not +exists: $!")' not exists: Permission denied # echo $EUID 0 # perl -E 'say ((-e q-/var/log/apache2/access.log-) ? "exists" : "not +exists: $!")' exists

        He probably just should examine $!