Posted by Dave Ponting on 2001-05-31
On Thu, 31 May 2001, Jason Blevins wrote:
> Hey Fellow Programmers!
> I have written a terminal based program for Linux for my company and it
> works fine, all but the fact that It can be stopped with Ctrl-C giving the
> user access to the shell. Here's how the program works. You log in, do your
> data entry and exit. When the program exits, it kills its parent process
> (bash) and forces you back to the login prompt. Can anyone tell me of a way
> to stop Ctrl-C from ending the program and a better way to force the user
> back to the login prompt if he/she decides to exit the program?
>
> Thanks in advance!
> Jason
> >
>
Yup. The best thing to do is to set their shell to your program. in other
words, when they log in, the login program simply calls your program
instead of bash. this avoids the Ctrl-C issue, and is much cleaner upon
logout. You just need to open /etc/passwd, find the line for the user in
question, and replace '/bin/bash' on that line with <path to your
program>.
-Dave Ponting <pontingdavid@xxx.xxx>
"If ignorance is bliss, why aren't -o)
there more happy people?" /\
-Anon _\_v
Previous post | Next post | Timeline | Home