views:

54

answers:

3

I hope this is the right forum for this, and excuse the naive question.

I would like to provide an "guest" login to a (non-dedicated) linux server and run just one console application. The user cannot do anything more than use this application. A scenario could be:

      ssh dervinATsomehost.com (no password)

and the just automatically execute the shell app, say

       Welcome to Dervin's shell.
       Dervin$

when the user says exit, the whole connection would drop, not just the application.

This seems relatively simple, but I wouldn't know where to start.

Thanks.

[NOTE I've posted this on Serverfault also. Did not know which forum was the best. Feel free to close if it's not pertinent.]

+3  A: 

You could set the desired application as the user's shell in /etc/passwd.

So when the user logs in, instead of bash session they get straight into the application.

Dave Webb
Yep, this is the most secure, and is often used by professional hosters as well.
wvdschel
A: 

I guess first you'd want to pick a language to work in. Something with a code-evaluation function like Scheme's eval make the "E" part of REPL easier. Other than that, it's just reading user input and printing the results of the evaluation(s). Then looping, of course.

Evan Meagher
A: 

You'll definitely want to distribute ssh keys to everyone, or, have them generate their own, and give those to you. Add the program you want executed to the list in /etc/shells, and use chsh on those users to change their shell to that program.

supercheetah