From owner-freebsd-questions Mon Jun 16 23:19:54 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id XAA25798 for questions-outgoing; Mon, 16 Jun 1997 23:19:54 -0700 (PDT) Received: from mail.EUnet.hu (www.eunet.hu [193.225.28.100]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id XAA25774 for ; Mon, 16 Jun 1997 23:19:49 -0700 (PDT) Received: by mail.EUnet.hu, id IAA28663; Tue, 17 Jun 1997 08:19:39 +0200 Received: (from zgabor@localhost) by CoDe.hu (8.7.5/8.7.3) id RAA00302; Mon, 16 Jun 1997 17:37:38 +0200 (MET DST) From: Zahemszky Gabor Message-Id: <199706161537.RAA00302@CoDe.hu> Subject: Re: Restricted Shell To: freebsd-questions@freebsd.org (FreeBSD questions) Date: Mon, 16 Jun 1997 17:37:37 +0200 (MET DST) Cc: psd@worldaccess.nl In-Reply-To: from Paul Dekkers at "Jun 12, 97 06:22:03 pm" X-Mailer: ELM [version 2.4ME+ PL11 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > Hi > > What's the best method of ristricting a shell under FreeBSD or any other > UNIX? Not very good, but try to get pdksh, and use it as a restricted Bourne- or Korn-shell. Bye, Gabor -- #!/bin/ksh Z='21N16I25C25E30, 40M30E33E25T15U!' ;IFS=' ABCDEFGHIJKLMNOPQRSTUVWXYZ ';set $Z;for i { [[ $i = ? ]]&&print $i&&break;[[ $i = ??? ]]&&j=$i&&i=${i%?};typeset -i40 i=8#$i;print -n ${i#???};[[ "$j" = ??? ]]&&print -n "${j#??} "&&j=;typeset +i i;};IFS=' 0123456789 ';set $Z;X=;for i { [[ $i = , ]]&&i=2;[[ $i = ?? ]]||typeset -l i;X="$X $i";typeset +l i;};print "$X"