From: schemers@vela.acs.oakland.edu (Roland Schemers III)
Subject: Re: Single user booting of DECStations and security
Date: 5 Apr 90 17:06:28 GMT [thread overview]
Message-ID: <597@vela.acs.oakland.edu> (raw)
In-Reply-To: 1990Apr5.123703.2251@maths.tcd.ie
Hello! The following is a script and a C program that implements the
security you are talking about. It stops someone from booting in single
user mode as root. To boot single user, you have to give the root's
password. I modified to accept another password, just incase the
passwd file is corrupt, or you forget the root password!!!
-------------------------------------------------------------------------
/* Compile it as :
# cc -s -o /etc/chkpas chkpas.c
# chmod 700 /etc/chkpas
Author: Lucian S. Herscovici - DEC France
Description:
Checks password validity for the given user (argument #1). If no
argument is provided it defaults to ``root''
The return status is 1 if the password is valid 0 otherwise
Modified: Roland Schemers, Oakland University
Add check for SPECIAL password other than root's.
This might be needed if passwd file becomes corrupt..
*/
#include <pwd.h>
#include <strings.h>
#include <stdio.h>
#define SPECIAL "secret"
main(argc,argv)
int argc;
char *argv[];
{
static char prompt[80];
static char pwkey[3];
static char *user = "root";
char *pp, *getpass(), *crypt();
struct passwd *getpwnam(), *pw;
if (argc>1) user = argv[1];
sprintf(prompt,"Enter %s's password to continue : ",user);
if ((pp=getpass(prompt)) == NULL) exit(0);
if (strcmp(pp,SPECIAL)==0) exit(1);
if ((pw=getpwnam(user)) == NULL) exit(0);
strncpy(pwkey,pw->pw_passwd,2);
pwkey[2]=0;
if (strcmp(crypt(pp,pwkey),pw->pw_passwd)) exit(0);
exit(1);
}
-------------------------------------------------
# @(#).profile ULTRXI/ULTRIX WS
# Author : L. Herscovici DEC France
# Loop forever until a legal password is typed in
trap "" 2 0
while :
do
if /etc/chkpas
then
echo 'INCORRECT ** REPEAT PLEASE**'
else
echo 'CORRECT : Entering command mode'
break
fi
done
echo 'erase ^?, kill ^U, intr ^C'
stty dec prterase new
PATH=/usr/ucb:/bin:/usr/bin:/etc:/usr/local:/usr/new:/usr/hosts:.
export PATH
trap 2 0
--
Roland J. Schemers III Systems Programmer
schemers@vela.acs.oakland.edu (Ultrix) Oakland University
schemers@argo.acs.oakland.edu (VMS) Rochester, MI 48309-4401
next prev parent reply other threads:[~1990-04-05 17:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1990-04-05 12:37 Single user booting of DECStations and security Alan Judge
1990-04-05 17:06 ` Roland Schemers III [this message]
1990-04-17 12:27 ` Yedidya Israel
1990-04-17 16:50 ` Ian! D. Allen [CGL]
1990-04-18 12:48 ` Robert Macomber
1990-04-19 12:08 ` Yedidya Israel
1990-04-20 22:23 ` Rob Burrowes
1990-04-28 5:03 ` Jason Heirtzler
1990-04-17 19:59 ` Richard Wood
1990-04-17 22:35 ` Eduardo Santiago
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox