[Linux] suid scripts
Pablo Averbuj
pablo@gos.nu
Tue, 3 Oct 2000 02:23:02 -0400
.----| Danny Rathjens (Mon, Oct 02, at 08:08PM) |--------------
| Am I going senile? Any idea why this doesn't work?
| (I did RH7-custom-upgrade a week ago)
Like kendrick mentioned, no suid shell scripts. You can either use sudo or
a C wrapper.
[ .. searching for code .. ]
Ah! here it is:
--------- wrap.c ------------
#define REAL_PATH "/path/to/script"
main(ac, av)
char **av;
{
setuid(0);
execv(REAL_PATH, av);
}
-----------------------------
If you're writing in perl, try suidperl but read all the rtfm a bit first as
there may be some precautions you should be taking (like taint checks).
--
--[ Pablo Averbuj ]--%--[ pablo@averbuj.com ]-%-[ http://pablo.averbuj.com ]--
---[ Finger pablo@averbuj.com for PGP key ]---%---[ Perl Warrior at large ]---