An alternative to `asroot'

Karl Kleinpaste karl at cbrma.UUCP
Sun Dec 8 21:58:35 AEST 1985


In article <2821 at watvlsi.UUCP> ksbszabo at watvlsi.UUCP (Kevin Szabo) writes:
>Thus I have written a small command called 'asroot' which will
>momentarily give a process root permissions.

Here's an alternative to `asroot.'  This is a small program which does
nothing more than exec a shell (typically csh, for me) with exactly
those arguments with which it was called.  I have this on multi-user
systems, but it lives in a private bin directory with mode 700, so no
one but me can get at it unless they're already root or me.

Typical usage is
	% enable
which gives me a plain root shell, or
	% enable -fc 'some random single command to be executed'

/* THIS PROGRAM MUST HAVE 04750 PERMISSIONS, AND BE OWNED BY  */
/* USER ROOT AND THAT GROUP WHICH IS TO BE ALLOWED TO USE IT. */

main (argc, argv)
	int	argc;
	char	*argv[];
{
	setgid (5);
	setuid (0);
/*	nice (-4);	de-comment only if you want to be rude/nasty */
	execv ("/bin/csh", argv);
}

-- 
Karl Kleinpaste



More information about the Comp.sources.unix mailing list