Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!psuvax1!psuvm!barilvm!bimacs!yedidya From: yedidya@bimacs.BITNET (Yedidya Israel) Newsgroups: comp.unix.wizards Subject: SUMMERY: Single user security on DEC workstations. Message-ID: <1053@bimacs.BITNET> Date: 4 Sep 89 12:04:58 GMT Organization: Math & CS, BarIlan U, Ramat-Gan, Israel Lines: 181 In a previous article I asked: > >We have a few workstation of DEC running Ultrix3.0 with DECwindows. > >In order to prevent users from having root privileges (via b/2 on >console) we put an "exec /bin/login" in /.profile. > Thanks to all of those who replied, these are the answers I got: From: Amos Shapir We use the following program (called /.lockup) and calls it from /.profile It is not completly secure, but I hope you can use it. Regards Carl-Lykke /* Written by Bruce G. Barnett */ #include #include #include struct passwd *pwd; struct passwd *getpwuid(); char *strcpy(); char *crypt(); char *getpass(); char *pw; char pwbuf[10]; char *rootpw = "DEFAULT_CRYPTED_PASSWD"; #define MESSAGE() fprintf(stderr, "\n\007\007\n%s\n%s\n%s\n%s\n\n", \ "***********************************************************", \ "*** THE SYSTEM IS IN AN INCONSISTENT STATE ***", \ "*** PLEASE, CONTACT THE COMPUTER DEPARTMENT IMMEDIATELY ***", \ "***********************************************************") main() { int msg = 0; signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); signal(SIGTSTP, SIG_IGN); /* Get the password entry for root */ /* use 0 if you want to hard-wire the passwd for root */ /* else use getuid() */ pwd=getpwuid(0); if (pwd != NULL) rootpw = pwd->pw_passwd; while (1) { if (msg++ % 5 == 0) MESSAGE(); strcpy(pwbuf,getpass("Password:")); pw = crypt(pwbuf, rootpw); if (strcmp(pw, rootpw) == 0) exit(0); } } From: barnett@unclejack.crd.ge.com (Bruce Barnett) We used to do this until it corrupted our file systems. If a system crashed, and rebooted, and it could not automatically repair the disks, it would go into single user mode. When it executed login, it would wait for a password, not get one, and terminated. Then the system would continue the reboot, going into multi-user mode WITHOUT REPAIRING THE DISK! Eventually the disk became very corrupted and we lost a lot of files. My solution was to run a program lock.c instead of login: lock.c: #include #include #include struct passwd *pwd; struct passwd *getpwuid(); char *strcpy(); char *crypt(); char *getpass(); char *pw; char pwbuf[10]; main() { signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); signal(SIGTSTP, SIG_IGN); /* get the password entry for root */ /* use 0 if you want to hard-wire the passwd for root */ /* else use getuid() */ pwd=getpwuid(getuid()); if (pwd == NULL ) (void) fprintf(stderr,"Cannot get password entry for root"); while ( 1) { /* forever */ (void) strcpy(pwbuf,getpass("Password:")); pw = crypt(pwbuf, pwd->pw_passwd); if (strcmp(pw,pwd->pw_passwd) == 0 ) { return(0); } } } -- Bruce G. Barnett uunet!crdgw1!barnett -- | Israel Yedidya, Math & CS Department, Bar-Ilan U, Ramat-Gan, ISRAEL. | +----------------------------------------------------------------------+ | Bitnet: yedidya@bimacs | | Internet: yedidya@bimacs.biu.ac.il | | Arpa: yedidya%bimacs.bitnet@cunyvm.cuny.edu | | Uucp: ...!uunet!mcvax!humus!bimacs!yedidya | | Csnet: yedidya%bimacs.bitnet%cunyvm.cuny.edu@csnet-relay | \----------------------------------------------------------------------/ \--- If someone proves there is no God, I'll stop being religious ---/ --------------------------------------------------------------------