Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!unirot!althea!rjd From: rjd@althea.UUCP (Rob Diamond) Newsgroups: comp.sys.att Subject: slide - a command to make you root Message-ID: <223@althea.UUCP> Date: Tue, 17-Nov-87 10:26:38 EST Article-I.D.: althea.223 Posted: Tue Nov 17 10:26:38 1987 Date-Received: Thu, 19-Nov-87 20:14:52 EST Organization: Terrapin Station - New Brunswick, NJ Annex Lines: 187 Keywords: handy, time-saving This is slide, a little program I find very handy on the 3b1. It allows selected users to become root without prompting for a password. You can run slide with no arguments, in which case it invokes a shell ($SHELL) with root permissions, or you can run it with arguments, in which case it runs the arguments as a command line with root permissions. You need superuser privilages to install this. It wants a group to exist that has permissions to run this (see README). Be careful with this program, if installed improperly, people who you don't want to be root may be able to become root. ------------------------(cut here)--------------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh MANIFEST <<'END_OF_MANIFEST' XFilename Archive # X---------------------------- X MANIFEST (This File) 01 X slide.c 01 X README 01 X Makefile 01 END_OF_MANIFEST if test 174 -ne `wc -c slide.c <<'END_OF_slide.c' X/********************************************* X * slide - become superuser temporarily * X * * X * Copyright 1987 - Robert Diamond * X * diamond@althea.rutgers.edu * X * * X * With no arguments, slide will exec a * X * shell with root permissions. The shell * X * should be specified in environment * X * variable $SHELL. * X * * X * With arguments, slide will treat the * X * arguments as a command line and try to * X * execute the command with root permissions* X * and exit. * X *********************************************/ X X#include X Xmain(argc, argv) Xint argc; Xchar *argv[]; X{ X char *shell, *getenv(); X X shell = getenv("SHELL"); /* Get desired shell */ X setuid(0); /* Setuid root */ X setgid(0); /* Setgid root */ X putenv("LOGNAME=root"); X putenv("PS1=# "); X if(argc <= 1) /* No arguments */ X { X if(shell) X { X execlp(shell, shell, 0); X perror(shell); X } X else X { X execl("/bin/sh", "sh", 0); X perror("/bin/sh"); X } X X } X else /* There are arguments */ X { X execvp(argv[1], &argv[1]); X perror(argv[1]); X } X} END_OF_slide.c if test 1288 -ne `wc -c README <<'END_OF_README' XSlide allows selected users to become root without entering Xa password. When slide is called without arguments, the Xenvironment variable $SHELL is checked, and if something is in Xit, it will run it as a shell with root permissions. If nothing Xis in it, it will run /bin/sh. X XIf you give slide arguments, it will run the arguments as a command Xline with root permissions, then return to your normal shell. X XSlide needs to be owned by root, and have a groupid that restricts Xaccess only to the people you want. X XYou will need to create a group that will consist of logins that will Xbe allowed to run slide. On my system, this group is called 'gods'. XTo do this, edit /etc/groups and add a new group XThen edit /etc/passwd and change group id's of the people you will Xallow root permissions. XIt's a good idea to do a 'find' on those people's home directories Xand change all the groupid's of files and directories to the new Xgroup. X XEdit the Makefile and assign the new group name to GRPNAM and Xthe location you want the executable to go in BINDIR. X Xrun 'make install' to compile and install slide. XYou must be root to do this correctly. X XBE CAREFUL! Anyone who can run this program will be able to become Xsuperuser. END_OF_README if test 1217 -ne `wc -c Makefile <<'END_OF_Makefile' X# Change the following 2 lines to fit your system. XGRPNAM = gods XBINDIR = /usr/local/bin X Xslide: slide.o X ld -s -o slide /lib/crt0s.o /lib/shlib.ifile slide.o X rm slide.o X Xslide.o: slide.c X cc -cO slide.c X Xinstall: slide X chown root slide X chgrp $(GRPNAM) slide X chmod 4750 slide X mv slide $(BINDIR) END_OF_Makefile if test 309 -ne `wc -c