* --> How can *I* reboot my machine? <--
@ 1996-07-19 4:00 D. White
1996-07-20 4:00 ` Tom Regan
1996-07-26 4:00 ` Heiner Steven
0 siblings, 2 replies; 8+ messages in thread
From: D. White @ 1996-07-19 4:00 UTC (permalink / raw)
Here's a tricky one. Everyone in the office has their own personal UNIX
boxes (Dec AlphaStations running OSF/1), but only the sys.admin has
su access. The work that I do and (unfortunately) the errors in code that
I make seem to crash my machine fairly often. The machine doesn't die
completely, though, and I can still telnet into the machine from
a neighboring workstation. Killing all my processes doesn't not release
the deathgrip on my machine, however, so I have to wander around the
office till I find the sys.admin and have her reboot the machine.
Is there any way that I can be given access to the /usr/sbin/reboot
command for my own machine, without giving me full root access? I don't
need any other superuser functions besides "reboot", and both the
sys.admin and I would be happier if I could do it myself rather than
hunt her down each time the computer crashes. She thinks it's possible
to give me reboot control without other root privileges, but isn't sure
how. Can anyone suggest a way?
Thanks to anyone who can help!
=-=-= David =-=-=
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: --> How can *I* reboot my machine? <--
1996-07-19 4:00 --> How can *I* reboot my machine? <-- D. White
@ 1996-07-20 4:00 ` Tom Regan
1996-07-20 4:00 ` Andrew Gierth
1996-07-26 4:00 ` Heiner Steven
1 sibling, 1 reply; 8+ messages in thread
From: Tom Regan @ 1996-07-20 4:00 UTC (permalink / raw)
Write a short C program (call it rboot)
main()
{
setuid(0);
setgid(0);
system("/usr/sbin/reboot");
exit (0);
}
Set the owner to root, and chmod 4755.
--
tomr@pinn.net Tom Regan
Jobs For Handicapped Inc.
Virginia Beach, Va.
(804) 499-9684
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: --> How can *I* reboot my machine? <--
1996-07-20 4:00 ` Tom Regan
@ 1996-07-20 4:00 ` Andrew Gierth
1996-07-22 4:00 ` John Hascall
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Gierth @ 1996-07-20 4:00 UTC (permalink / raw)
>>>>> "Tom" == Tom Regan <tomr@pinn.net> writes:
Tom> Write a short C program (call it rboot)
Tom> main()
Tom> {
Tom> setuid(0);
Tom> setgid(0);
Tom> system("/usr/sbin/reboot");
Tom> exit (0);
Tom> }
Tom> Set the owner to root, and chmod 4755.
Just so you all know, on many systems this allows unlimited root access
to be obtained trivially.
For example, try
$ cat >usr <<\@EOF
#!/bin/sh
IFS=' '
unset IFS
PATH=/bin:/usr/bin:/etc
exec /bin/sh -i
@EOF
$ chmod a+x usr
$ PATH=. IFS=/ rboot
# id
uid=0(root) gid=0(root)
#
Some newer systems avoid this particular hole, but there are lots out
there where it is still wide open.
system() in a setuid program is a notorious source of holes. The
correct version of the program is:
#include <unistd.h>
#include <stdio.h>
int main(void)
{
setuid(0);
setgid(0);
execl("/usr/sbin/reboot","reboot",NULL);
perror("exec");
return 1;
}
Assuming /usr/sbin/reboot is an executable and not a shell script, the
above should be reasonably safe.
--
Andrew Gierth (andrewg@microlise.co.uk)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: --> How can *I* reboot my machine? <--
1996-07-20 4:00 ` Andrew Gierth
@ 1996-07-22 4:00 ` John Hascall
1996-07-24 4:00 ` Shriman Gurung
0 siblings, 1 reply; 8+ messages in thread
From: John Hascall @ 1996-07-22 4:00 UTC (permalink / raw)
Andrew Gierth <andrewg@microlise.co.uk> wrote:
}>>>>> "Tom" == Tom Regan <tomr@pinn.net> writes:
} Tom> Write a short C program (call it rboot)
} Tom> main()
} Tom> {
} Tom> setuid(0);
} Tom> setgid(0);
} Tom> system("/usr/sbin/reboot");
} Tom> exit (0);
} Tom> }
} Tom> Set the owner to root, and chmod 4755.
}Just so you all know, on many systems this allows unlimited root access
}to be obtained trivially.
[...example...]
}system() in a setuid program is a notorious source of holes. The
}correct version of the program is:
}#include <unistd.h>
}#include <stdio.h>
}int main(void)
}{
} setuid(0);
} setgid(0);
} execl("/usr/sbin/reboot","reboot",NULL);
} perror("exec");
} return 1;
}}
}Assuming /usr/sbin/reboot is an executable and not a shell script, the
}above should be reasonably safe.
Or even simpler:
#include <sys/reboot.h>
int main (
int argc,
char ** argv
) {
return reboot(RB_AUTOBOOT);
}
(install owner=root group=those-allowed-to-reboot mode=4750)
John
--
John Hascall, Software Engr. Shut up, be happy. The conveniences you
ISU Computation Center demanded are now mandatory. -Jello Biafra
john@iastate.edu
http://www.cc.iastate.edu/staff/systems/john/welcome.html <-- the usual crud
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: --> How can *I* reboot my machine? <--
1996-07-24 4:00 ` Shriman Gurung
@ 1996-07-24 4:00 ` Tim Mooney
0 siblings, 0 replies; 8+ messages in thread
From: Tim Mooney @ 1996-07-24 4:00 UTC (permalink / raw)
In article <Pine.SOL.3.94.960724151033.26198B-100000@flemming>,
Shriman Gurung <shriman@well.ox.ac.uk> wrote:
> Doesn't the sudo package address this sort of problem? It allows
> a root-ish sort of command (eg reboot, shutdown etc) to be run by
> a certain class of user (mentioned in the sudoers file) without knowing
> the root password. Try sunsite for the source (or archie).
ftp://ftp.cs.colorado.edu/pub/sysadmin/sudo/cu-sudo.v1.4.tar.Z
There is small patch necessary for sudo 1.4 to work with C2 security under
4.0. You'll also discover that Digital forgot to ship /usr/include/acl.h
with 4.0 (it's referenced by /usr/include/prot.h), but the acl.h in
/usr/sys/include/sys works, so adding
-I/usr/include -I/usr/sys/include/sys
to the CFLAGS fixes the problem.
Tim
--
Tim Mooney mooney@toons.cc.ndsu.NoDak.edu
Information Technology Services (701) 231-1076 (Voice)
Room 242-J6, IACC Bldg. (701) 231-8541 (FAX)
North Dakota State University, Fargo, ND 58105
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: --> How can *I* reboot my machine? <--
1996-07-22 4:00 ` John Hascall
@ 1996-07-24 4:00 ` Shriman Gurung
1996-07-24 4:00 ` Tim Mooney
0 siblings, 1 reply; 8+ messages in thread
From: Shriman Gurung @ 1996-07-24 4:00 UTC (permalink / raw)
Doesn't the sudo package address this sort of problem? It allows
a root-ish sort of command (eg reboot, shutdown etc) to be run by
a certain class of user (mentioned in the sudoers file) without knowing
the root password. Try sunsite for the source (or archie).
Shriman Gurung
shriman@well.ox.ac.uk
On 22 Jul 1996, John Hascall wrote:
> Andrew Gierth <andrewg@microlise.co.uk> wrote:
> }>>>>> "Tom" == Tom Regan <tomr@pinn.net> writes:
> } Tom> Write a short C program (call it rboot)
> } Tom> main()
> } Tom> {
> } Tom> setuid(0);
> } Tom> setgid(0);
> } Tom> system("/usr/sbin/reboot");
> } Tom> exit (0);
> } Tom> }
> } Tom> Set the owner to root, and chmod 4755.
> }Just so you all know, on many systems this allows unlimited root access
> }to be obtained trivially.
> [...example...]
> }system() in a setuid program is a notorious source of holes. The
> }correct version of the program is:
> }#include <unistd.h>
> }#include <stdio.h>
> }int main(void)
> }{
> } setuid(0);
> } setgid(0);
> } execl("/usr/sbin/reboot","reboot",NULL);
> } perror("exec");
> } return 1;
> }}
> }Assuming /usr/sbin/reboot is an executable and not a shell script, the
> }above should be reasonably safe.
>
> Or even simpler:
>
> #include <sys/reboot.h>
> int main (
> int argc,
> char ** argv
> ) {
> return reboot(RB_AUTOBOOT);
> }
> (install owner=root group=those-allowed-to-reboot mode=4750)
>
>
> John
> --
> John Hascall, Software Engr. Shut up, be happy. The conveniences you
> ISU Computation Center demanded are now mandatory. -Jello Biafra
> john@iastate.edu
> http://www.cc.iastate.edu/staff/systems/john/welcome.html <-- the usual crud
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: --> How can *I* reboot my machine? <--
1996-07-19 4:00 --> How can *I* reboot my machine? <-- D. White
1996-07-20 4:00 ` Tom Regan
@ 1996-07-26 4:00 ` Heiner Steven
1996-07-30 4:00 ` R Denholm
1 sibling, 1 reply; 8+ messages in thread
From: Heiner Steven @ 1996-07-26 4:00 UTC (permalink / raw)
D. White (dswhite@email.unc.edu) wrote:
[...]
> Is there any way that I can be given access to the
> /usr/sbin/reboot command for my own machine, without giving me
> full root access? I don't need any other superuser functions
> besides "reboot", and both the sys.admin and I would be happier
> if I could do it myself rather than hunt her down each time the
> computer crashes. She thinks it's possible to give me reboot
> control without other root privileges, but isn't sure how. Can
> anyone suggest a way?
You could create a pseudo-user "reboot" with the user id "0"
(root), home directory "/" and shell "/usr/sbin/reboot". Be sure
to chose a good password.
If the user "reboot" logs in, the command /usr/sbin/reboot will
be executed automatically.
Some systems require all login shells to be listed in a file,
i.e. "/etc/shells". Your sysadmin will have to add
"/usr/sbin/reboot" to this file.
Heiner
--
-------------------------------------------------------------
/ Heiner Steven hs@bintec.de / The expressed opinions are /
/ BinTec Communications / mine, not BinTec's -- /
/ Willstaetterstr. 30 ------- ...even if they should be ;-)/
/ D-90449 Nuernberg / priv.: heiner@hsysnbg.nbg.sub.org /
------------------------------------------------------------
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: --> How can *I* reboot my machine? <--
1996-07-26 4:00 ` Heiner Steven
@ 1996-07-30 4:00 ` R Denholm
0 siblings, 0 replies; 8+ messages in thread
From: R Denholm @ 1996-07-30 4:00 UTC (permalink / raw)
heiner@BinTec.DE (Heiner Steven) wrote:
>D. White (dswhite@email.unc.edu) wrote:
>[...]
> > Is there any way that I can be given access to the
> > /usr/sbin/reboot command for my own machine, without giving me
> > full root access? I don't need any other superuser functions
the super program also would allow this to be done.
see http://hpux.csc.liv.ac.uk
Also on HPs refer your admin to file /etc/shutdown.allow
--
mailto:roger.denholm@das.gov.au
My opinions are mine and do not represent any govt body including my own
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~1996-07-30 4:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-07-19 4:00 --> How can *I* reboot my machine? <-- D. White
1996-07-20 4:00 ` Tom Regan
1996-07-20 4:00 ` Andrew Gierth
1996-07-22 4:00 ` John Hascall
1996-07-24 4:00 ` Shriman Gurung
1996-07-24 4:00 ` Tim Mooney
1996-07-26 4:00 ` Heiner Steven
1996-07-30 4:00 ` R Denholm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox