LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-22-2002, 04:11 PM   #1
Xpolloloco
LQ Newbie
 
Registered: Aug 2002
Posts: 3

Rep: Reputation: 0
trapping signals at bootup


Hi all,
this might go beyond the scope of a "newbie" question, but it likes like this is the best place to ask since slackware doesn't have their own forum anymore. I have a workstation that automatically logs in a user out of inittab. I believe the line is something like:

agetty -n -l /path/to/my/replacement/login

It automatically starts up X Windows, and I have that locked down as well. I have the users's stty settings set in such a way that they cannot CTRL+C, CTRL+Z, etc. out of anything. My only problem is right at startup... When /etc/rc.d/rc.M runs, and it goes through the "going multiuser...." stuff, if you start hitting CTRL+C and put a stop to the process before its finished running everything. This escapes the user to a prompt, but I don't want them to get a prompt.

Does anyone know of a way to prevent this from happening, and trapping those signals? Any pointers or suggestions will be much appreciated, even if its "hey, go ask these guys at this forum." Thanks!! B-)

./brm
 
Old 08-22-2002, 06:32 PM   #2
Excalibur
Senior Member
 
Registered: Jun 2002
Location: Northern VA, USA
Distribution: Ubuntu
Posts: 1,180

Rep: Reputation: 46
I am not sure if this is what you are looking for directly or not. But in the /etc/passwd file the last item in the list for the specific account that you are using is the shell for that user account. Normally it is set to something like /bin/bash. Try setting it to something else. Like a bash shell script with the command logout.

You might also consider to use run level 4, instead of runlevel 3. That produces a GUI login prompt that can require a password for the users. Never leaving X windows. The users allowed to use the GUI can also be controlled or limited to just the users you desire. There is one getty on tty6 (Ctrl-Alt-F6 in X windows) that would need to be dealt with that would produce a login prompt. But if you remove the shell statement from their account in the password file I think it would disable their login at that prompt because it would not have a shell provided.

Perhaps the info will be of some assistance.
 
Old 08-22-2002, 10:43 PM   #3
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
You can try to trap signals at the beginning of rc.M.
Code:
SigInt()
{
   echo "SigInt trapped"
}

trap "SigInt 2" INT
You may have to trap other signals that my break execution.
 
Old 08-23-2002, 09:43 AM   #4
Xpolloloco
LQ Newbie
 
Registered: Aug 2002
Posts: 3

Original Poster
Rep: Reputation: 0
Excalibur & crabboy,

Thanks for the info there. I already have the users shell setup something like this:
---------
#!/bin/ksh
allowed_ttys="/dev/tty1"
real_shell="/bin/tcsh"
my_tty="$(/usr/bin/tty)"

eval [[ $my_tty != $allowed_ttys ]] && exit 1

exec -a -${real_shell##*/} $real_shell ${1+"$@"}
--------

the .login file for this particular user nullifies the stty settings for particular signals such as int, eof, etc. after it sets those, it starts xinit/X, and when X is done running it reboots the computer. (I have halt set to 4755).

The problem is when CTRL+C is hit while rc.M is running. As I said, people can break out of that and get a shell prompt before the faked "login" program that I set in inittab.

My "login program" is essentially 'su - user' which of course then runs the .login. CTRL+C circumvents this whole login process. I tried the runlevel 4 stuff, but that starts up xdm/gdm/kdm and presents the user with a login box. I need to have an autologin.

So I appreciate the info Excalibur, but I pretty much tried it already. It seems that you and I are of the same frame of mind. :-) Crabboy, I'll try your method and post another reply.

Thanks you two! I really do appreciate it. Take care.
./brm
 
Old 08-23-2002, 10:21 AM   #5
Xpolloloco
LQ Newbie
 
Registered: Aug 2002
Posts: 3

Original Poster
Rep: Reputation: 0
Crabboy,

I just tried your approach and that seems to work. And I realized it wasn't breaking out of rc.M it was breaking out of rc.local which basically just says "echo 'Entering Kiosk Mode.....'" (or so this appears to be the case). So I added your SigInt() idea to both rc.M and rc.local

Now when rapidly hitting CTRL+C, it attempts to break, but then the respawn function in inittab that starts the agettys, says something about respawning too fast and that it won't do it again for another 5 minutes. So that's good!! :-D Thank you both very much for the help/suggestions.

./brm
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
trapping packets mohit_garg Linux - Networking 6 07-10-2005 06:29 PM
Trapping user logins in python thinkgeek Programming 1 07-06-2005 01:16 AM
Trapping NFS requests Jayendra Linux - Networking 0 03-01-2004 10:17 AM
Trapping an exit status chrisk5527 Linux - General 3 09-12-2003 10:02 PM
Trapping keystrokes in C k4zau Programming 3 03-09-2003 02:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration