[hackpgh-discuss] Re: Custom Restricted Shell

  • From: Simon Heath <icefoxen@xxxxxxxxx>
  • To: hackpgh-discuss@xxxxxxxxxxxxx
  • Date: Sat, 21 Mar 2015 12:33:10 -0400

rbash seems to be the first solution one would find to this; it appears to disallow changing the shell's PATH or entering a command containing a slash, so you can set up a custom PATH that only contains what programs you want to allow.


That said it's far from foolproof. Notably, pretty much any program that can invoke a particular command can be used to spawn an unrestricted shell, such as less, vi or emacs.

Sudo will let you limit which commands a user is allowed to run through it, which *is* pretty difficult to subvert, but that doesn't sound quite like what you want.

You can also mess with group permissions or ACL's to create an untrusted group that doesn't have execute permissions to most programs, or even give a particular user a login 'shell' that is a script that can only do certain things (if you write the script carefully). It's not an easy problem to solve in the general case though, since "run a particular command" can mean a wide variety of things in practice.

Simon

On 3/21/2015 9:59 AM, John Lewis wrote:
Does anybody know how to create a restricted shell? I need to create a
restricted shell that is extended with a couple of commands so that I
can do database dumping or file sharing using a protocol not supported
by rssh without allowing for an interactive login.




Other related posts: