#!/usr/bin/perl # /home/zengargoyle/sudotest.pl exec '/usr/bin/sudo', '/bin/bash', '-c', $0 unless exists $ENV{SUDO_USER}; # if not angsty sysadmins vs sudo commands use this. # exec '/usr/bin/sudo', $0 unless exists $ENV{SUDO_USER}; print "hello from root\n"; system 'ls'; #### $ cd / $ /home/zengargoyle/sudotest.pl [sudo] password for zengargoyle: hello from root auto dev initrd.img.old mnt ... ... $