in reply to Automating sudo actions
chmod +x it.#!/usr/bin/perl # /home/zengargoyle/sudotest.pl exec '/usr/bin/sudo', '/bin/bash', '-c', $0 unless exists $ENV{SUDO_US +ER}; # 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 ... ... $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Automating sudo actions
by rastoboy (Monk) on Jan 27, 2011 at 00:15 UTC |