LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Run application when user connects with telnet (https://www.linuxquestions.org/questions/linux-newbie-8/run-application-when-user-connects-with-telnet-4175553843/)

Selecta 09-18-2015 03:26 AM

Run application when user connects with telnet
 
When I user connects to my telnet server I want it to run an application rather than drop him to a command line.

How might I do that?

Thank you!

chrism01 09-18-2015 03:37 AM

A couple of options:

1. call your app as part of the login process (user's bash_profile)

2. Make your app network aware and attach it to the telnet port instead of the telnet server.

goumba 09-18-2015 03:41 AM

3. You may also set the application as the user's login shell.

chrism01 09-18-2015 03:45 AM

Actually, that's better than my num 1. :)

Selecta 09-18-2015 01:41 PM

I added the run command to the bottom of my .bashrc and that worked like a charm. Next I would like the telnet session to disconnect when the application exits. Is that possible?

Thank you!

hortageno 09-18-2015 01:52 PM

Quote:

Originally Posted by Selecta (Post 5422377)
I added the run command to the bottom of my .bashrc and that worked like a charm. Next I would like the telnet session to disconnect when the application exits. Is that possible?

Thank you!

See post #3.

Selecta 09-18-2015 03:25 PM

I got it. I just put exit after the application start line in the .bashrc and I'm good to go.

jpollard 09-19-2015 08:48 AM

Quote:

Originally Posted by Selecta (Post 5422410)
I got it. I just put exit after the application start line in the .bashrc and I'm good to go.

Doesn't work if the user uses control C to interrupt it.

That is why making the users shell the program works better.


All times are GMT -5. The time now is 02:41 AM.