Xref: utzoo comp.unix.questions:31677 comp.unix.shell:2255 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!wuarchive!uunet!bria!mike From: mike@bria.UUCP (mike.stefanik) Newsgroups: comp.unix.questions,comp.unix.shell Subject: Re: Looking for a restricted shell. Message-ID: <270@bria.UUCP> Date: 25 May 91 18:13:38 GMT References: <1991May23.033109.10724@DMI.USherb.CA> Reply-To: uunet!bria!mike Followup-To: comp.unix.questions Organization: MGI Group International, Los Angeles, CA Lines: 41 In an article, pineault@sarcelle.DMI.USherb.CA (Christian Pineault) writes: >I'm looking for a shell on SunOS 4.1.1 that would prevent users from >using any [h]armful commands. Here is the source to a shell that you might find useful: #include #include #include main(argc,argv) int argc; char *argv[]; { char *image, buf[1024]; char *tok; signal(SIGINT,SIG_IGN); signal(SIGQUIT,SIG_IGN); image = strrchr(argv[0],'/'); image++; printf("$ "); while ( fgets(buf,1024,stdin) != NULL ) { tok = strtok(buf," \t\n"); if ( ! strcmp(tok,"exit") ) break; if ( tok && strlen(tok) > 0 ) fprintf(stderr,"%s: %s: permission denied\n", image, tok); printf("$ "); } return 0; } -- Michael Stefanik, MGI Inc, Los Angeles | Opinions stated are never realistic Title of the week: Systems Engineer | UUCP: ...!uunet!bria!mike ------------------------------------------------------------------------------- If MS-DOS didn't exist, who would UNIX programmers have to make fun of?