2

I am trying to write a simple telned server that will expose a IPython shell to the connected client. Does someone know how to do that ?

The question is really about embedding the IPython shell into the Telnet server (I can probably use Twisted for the Telnet server part )

Thx

Dave
  • 1,835
  • 4
  • 26
  • 44
  • 1
    possible duplicate of [python: twisted app with interacive python shell](http://stackoverflow.com/questions/23633167/python-twisted-app-with-interacive-python-shell) – Kartoch Mar 07 '15 at 20:58

2 Answers2

1

You could perhaps use a true telnet or SSH server and just set the user's login shell to be IPython. For instance, given a user whose name is 'adam', perhaps you could change the user's /etc/passwd line to something like:

adam:x:1000:1000:Adam Frist,,,:/home/adam:/usr/bin/ipython

Typically the final segment in the line is an actual login shell like bash, but it doesn't have to be. The advantage is that you can skip coding the solution yourself, but there may be a disadvantage in that you might have to hack environment variable or the Python path for it to work.

You can read more about the /etc/passwd file at the Linux Information Project.

Kurt McKee
  • 1,410
  • 13
  • 17
  • Hi Kurt, Really what i want is to eembed a python shell in my application i can connect to and control. So once connected i would like to have a shell and I like IPyhton . – Dave Nov 15 '11 at 08:20
0

I think it is not possible provide full functionality of IPython, such as auto complete,.. Twisted has python shell that works well with telnet.

Melug
  • 1,023
  • 9
  • 14
  • Ipython shell is just a wrapper over the normal python shell in case python shell can be embedded using twisted , surely you can do that with ipython as well – dusual Oct 11 '11 at 09:48
  • I don't agree Melug, I am pretty sure it is possible. Seems that I would have to discover it by myself. – Dave Oct 12 '11 at 14:57