- or download this
#!/usr/bin/perl
print "effective: $>, real: $<\n";
...
print "effective: $>, real: $<\n";
$< = 0; # no effect
print "effective: $>, real: $<\n";
- or download this
effective: 0, real: 0
Can't write bar: Permission denied
effective: 111, real: 111
effective: 111, real: 111
- or download this
quux [gm] /tmp/foo # ls -l
total 4
-rw-r--r-- 1 root root 0 2006-06-26 02:31 bar
-rw-r--r-- 1 111 root 0 2006-06-26 02:31 foo
-rw-r--r-- 1 root root 338 2006-06-26 02:29 setuid.pl
- or download this
setuid Sets the real user identifier and the effective user identi
+-
fier for this process. Similar to assigning a value to the
Perl's builtin $< variable, see "$UID" in perlvar, except
that the latter will change only the real user identifier.