0

I am using lshell in a linux environment.

I can create a session with this shell like

sudo -u dummy /usr/bin/lshell

but even if I add this line to the config file

forbidden       : [';', '&', '|','`','>','<', '$(', '${', 'exit']

dummy is still able to exit the shell.

Is there any way to lock dummy into his lshell session, blocking commands such as "exit" and blocking ctrl+C using lshell?

Leo
  • 6,480
  • 4
  • 37
  • 52
  • Why would you want to do this? Perhaps better to just make lshell be the login shell for these users, then no need for sudo and they can't escape it. – John Zwinck Mar 26 '14 at 14:53
  • I need to create an ajaxterm instance for localhost, but limited, since I am exposing my localhost session via web. Ajaxterm creates a session using ttycontrol.py, which takes the command line as argument – Leo Mar 26 '14 at 14:57

1 Answers1

1

oh, how fool I am :-)

I could just edit

/usr/lib/python2.6/site-packages/lshell.py

and comment

    #if self.g_cmd in ['quit', 'exit', 'EOF']:
    #    self.log.error('Exited')
    #    if self.g_cmd == 'EOF':
    #        self.stdout.write('\n')
    #    sys.exit(0)

:-)

Leo
  • 6,480
  • 4
  • 37
  • 52