Slashdot Mirror


X11 Serial Killer?

Chris Benard asks: "I frequently have problems with X just taking control of my keyboard, but not my mouse. My mouse still moves, but it isn't able to interact with X (not unlike a windows freeze). However, I would like to know if there is a program to listen on a serial port for commands and execute them as root. I have an HP48G calculator, and I would like to make a few short commands to execute from it to my serial port, such as killall -9 X and killall -9 netscape-communicator. Please let me know of any programs existing and any SDKs that I might use to produce my own program. " Has anyone managed to come up with a hack that might work for this situation?

14 comments

  1. Done this with PDA by Elvii · · Score: 2

    All I did is run getty to ttyS1 (where my palm is) and run a palm telnet app on the PDA, login just like a dumb terminal except dumb terminals don't have graffiti. :) login in as root, kill X, whatever ya want to do. Also came in handy for me when SVGAlib froze my console playing quake2. Not sure how this can work with the Ti, but if it has a telnet app and a serial cable of some sort, it might work.

    bash: ispell: command not found

    --
    This sig left intentionally blank.
  2. HP48 Software by kile · · Score: 2

    Go to the HP48 Terminal Emulation Programs page and download a terminal emulator.

    I think this is what you are looking for.

  3. How to do this (Was Re:Done this with PDA) by IO+ERROR · · Score: 1
    Add line to /etc/inittab (assuming SysVinit based system, e.g. RedHat, Mandrake, SuSE):

    s1:2345:respawn:/sbin/mingetty ttyS1

    Substitute your favorite getty program if mingetty doesn't get it for you. Note that mingetty is very minimal; it won't set the baud rate, for instance, so it would already have to be set, e.g. with setserial, elsewhere in the init scripts. Or use another getty which does support setting the baud rate. (I don't need serial terminals on this computer, so I don't have any other getty programs installed right now...)
    ---

    --
    How am I supposed to fit a pithy, relevant quote into 120 characters?
  4. Re:This may sound like a stupid questoin... by Spoing · · Score: 2
    if I were to do this while logged in as david and do an 'alt-SysRq-l' will I be able to bring the machine down to its knees?

    Yes.

    ObComment: Since this isn't a default part of any binary distribution I know of, you'll have to compile it. While there, it should take only a few minutes to remove the keyboard commands you don't want users to have...but then you won't have them either.

    --
    A firewall can not protect you from yourself. Turn off what you do not need. Do not use the firewall to do your work.
  5. a line of perl: by Rozzin · · Score: 1

    Try this:

    perl -ne 'system $_' /dev/ttyS0

    Replace "ttyS0" with whatever serial port you really want to use, of course, and make sure that you're serial port is set up with the correct baud rate and such, probably using stty.

    --
    -rozzin.
  6. More about Magic Sysrq on RH6.1+ and maybe others by Masker · · Score: 1

    Also, I found that in RH6.1, the /etc/rc.d/rc.sysinit was killing my magic sysrequest key:

    # Turn off sysrq
    if [ -f /proc/sys/kernel/sysrq -a "$MAGIC_SYSRQ" = "no" ]; then
    echo "0" > /proc/sys/kernel/sysrq
    action "Turning off Magic SysRq key" /bin/true
    fi

    So, you can just set the $MAGIC_SYSRQ variable to "yes" at top of the script (it doesn't currently exist, but you can add it) or comment out this section. Otherwise, a '0' will get catted to /proc/sys/kernel/sysrq which will shut off the magic sysrq functionality!

    --

    ---------The early bird gets the worm, but the second mouse gets the cheese.

  7. A standard getty prolly by technos · · Score: 2

    A standard getty and a HP term emulator will work great if you need an extensive set of stuff to be run, and you are on a 'secure' system. If you don't care about security on the box, and only need a couple of commands run, there is a getty out there called rungetty that can run other programs instead of login; All you'd need is to 'fake' a serial connection to have it run said program. (I keep one running on a spare serial port that runs reboot; All I needed was a momentary toggle to complete it)

    --
    .sig: Now legally binding!
  8. Re:More about Magic Sysrq on RH6.1+ and maybe othe by Spoing · · Score: 2

    That's interesting...it looks like they took it out in 6.2 (I just looked at a 'fresh' test system).

    --
    A firewall can not protect you from yourself. Turn off what you do not need. Do not use the firewall to do your work.
  9. That would be one way... by glens · · Score: 1

    Occasionally even getting into your box another way and killing off X or the svgalib program won't give you back normal control.

    Take a moment and read /usr/src/linux/Documentation/sysrq.txt and see if compiling that capability into your kernel isn't really what you want.

  10. Use JSLAUNCH it's perfect for this by bergeron76 · · Score: 1

    Theres an application called jslaunch with which you can assign applications to joystick buttons and sequences. I use it exactly for this reason. I have a 4 button joystick. The neat thing is that you can assign sequences to buttons also; so effectively (2^4)-1 possible combinations of programs are possible. But it's much easier to assin the "red" button to "killall -9 X". Hope this helps.

    --
    Don't think that a small group of dedicated individuals can't change the world. It's the only thing that ever has.
  11. if you're on a network.... by xyster · · Score: 1

    jump on another pc and telnet to your box and kill X that way

  12. Direct solution for your X problem by jannotti · · Score: 1

    Have you tried Ctrl-Alt-Backspace?
    I find that even when X seems locked up pretty tight that will kill it.

  13. GPM by SEWilco · · Score: 1

    Type "man gpm" and you'll see that it can be told to execute commands when mouse buttons are pressed in special ways. I often use it on keyboardless servers to allow an operator to initiate a controlled shutdown or restart.

  14. This may sound like a stupid questoin... by david@ecsd.com · · Score: 1

    I read the documentation and I'm wondering if you use the key combo to kill processes, does it do this regardless of the user? i.e. if I were to do this while logged in as david and do an 'alt-SysRq-l' will I be able to bring the machine down to its knees?

    David