Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^8: perl file status and sudo

by Anonymous Monk
on Mar 22, 2012 at 21:07 UTC ( [id://961103]=note: print w/replies, xml ) Need Help??


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

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 $!

Replies are listed 'Best First'.
Re^9: perl file status and sudo
by JavaFan (Canon) on Mar 22, 2012 at 22:20 UTC
    I cannot think of a situation where you have "read access to anything", but don't have read access to a directory. Anyway, if he needs read access to a directory, ACLs can be used. As I pointed out in my first reply.

      Viewing a directory listing requires read permission on the directory, but entering the directory and viewing the files inside it requires execute permission on the directory. He could be talking about something like that, where he has read permission for everything but can't see some files because he doesn't have execute permission on all directories. That's not real security, and it wouldn't make a lot of sense, but not much about this situation seems to.

      Aaron B.
      My Woefully Neglected Blog, where I occasionally mention Perl.

        Let's not try to guess what might be the case. Let's see whether the OP can describe what his actual problem, in a what that he can be helped. (But, if it is the case you're describing, it's again ACLs that will come to the rescue).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://961103]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-24 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found