0

We have a server that run with certain functionality. We want to enable some users with ssh authentication so that if an ssh session is initiated by the clients on certain port to the server, the sever will provide a custom terminal which supports only very few commands we have decided to implement.

My question is: how can I listen (in cpp) to incoming ssh connections, and after successful authentication provide them a terminal application.

Is there a package that supports some of that functionality?

Thanks!

cyber101
  • 899
  • 1
  • 9
  • 19

1 Answers1

1

sshd of course is configurable, and can be made to listen on different ports. These discuss it at length:

The underlying issue is what would one do with this. That has been asked before, with suggestions to setup a restricted shell (including using chroot). For discussion, see

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • Hi Thomas!! Thanks for the great answer. Actually, I originally thought about launching some terminal-mockup to logged-in user. Something like live interaction with python Cmd module [link](https://docs.python.org/2/library/cmd.html). So that the client will be restricted to a finite custom set of commands... – cyber101 May 14 '15 at 12:25
  • I guess there should be some simple way to redirect the shell into a certain script, right? – cyber101 May 17 '15 at 07:38
  • 1
    You could run your application within the `script` program. Some versions (different operating systems) are more capable, but "any" Unix has it. – Thomas Dickey May 17 '15 at 09:08