home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sun4nl!tuegate.tue.nl!svin02!wzv!rob
- From: rob@wzv.win.tue.nl (Rob J. Nauta)
- Newsgroups: comp.sys.sun.admin
- Subject: Re: creating restricted shell environments
- Message-ID: <3727@wzv.win.tue.nl>
- Date: 15 Aug 92 19:33:05 GMT
- References: <1992Aug6.135112.23720@lokkur.dexter.mi.us> <1992Aug10.171606.11806@oakhill.sps.mot.com> <1992Aug14.201534.1805@ultra.com>
- Organization: Sex, UNIX & Rock 'n Roll
- Lines: 47
-
- rfj@ultra.com (Ray Jackson) writes:
-
- | I just tried setting up an account under 4.1.2 that runs /usr/lib/rsh.
- |It's not very restricted:
-
- |$ cd /
- |cd: restricted
- |$ more /var/adm/messages
- |[stuff deleted]
- |!/bin/csh
- |/usr/lib/rsh: /bin/csh: restricted
- |------------------------
- |!csh
- |ultra% cd /
- |ultra% pwd
- |/
- |ultra% touch /tmp/test.rsh
- |ultra% ls -l /tmp/test.rsh
- |-rw-r--r-- 1 raccnt 0 Aug 14 13:11 /tmp/test.rsh
- |ultra%
-
- | Is there a way to make rsh really restricted?
-
- If you set it up badly, it isn't restricted at all. Take the following
- precautions:
-
- set the path to a separate directory containing only those commands
- needed. In your example 'more' was in the path. More isn't unsafe, it
- exec'ed the program via the shell, hence '/bin/csh' was restricted,
- but 'csh' wasn't. You probably put '/bin' in the PATH, which means you
- could just have typed 'csh' as well. Don't give the user unsafe
- commands, like a real shell, vi or cc, for example.
-
- Make the user's home directory owned by root, and unwritable. Also
- do the same for the .profile.
-
- In general, /usr/lib/rsh isn't that restricted. There are lots of tricks
- to break out of it. It's a seventies idea that has long been outdated.
- Try a custom-written C program as shell that doesn't allow exec's or
- shell escapes.
-
- Rob
- --
- /-----------------------------------------------\ ,==.
- | Rob J. Nauta, UNIX computer security expert. | /@ |
- | rob@wzv.win.tue.nl, Phone: +31-40-837549 | /_ <
- | Feel free to email me for free advice | =" `g'
-