Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Testing for group or world writable files

by stevieb (Canon)
on Jul 07, 2015 at 01:28 UTC ( [id://1133488]=note: print w/replies, xml ) Need Help??


in reply to Testing for group or world writable files

Here's one non-scientific way to check:

#!/usr/bin/perl use warnings; use strict; use Test::More; my $file = 'file.txt'; my $perms = sprintf("%o", (stat $file)[2] & 0777); my ($u, $g, $w) = split //, $perms; my @writable = qw(2 3 6 7); ok (!(grep /$g/, @writable), "File is not group writable"); ok (!(grep /$w/, @writable), "File is not world writable");

-stevieb

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 22:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found