TERM=linux for serial port
I want to find out whether a user is logged into my computer through the RS232 serial port.
For FC6 (kernel 2.6.18-1.2798), the environment variable TERM will be set to "linux" for serial port login. Isn't it? For all types of log in, then TERM will be set to something else, right? |
Don't rely on the TERM variable to help you out here. You might have TERM set to linux in other situations also.
I'm not the most qualified person to answer this, because almost all my experience has been on Slackware. But it might help. I'm answering because nobody has answered you for more than a day. Maybe any misinformation I give you might spur someone else to give a real answer. On Slackware, there's a file called "/etc/inittab". Among other things, it contains information about all the non-X ways you can log in. Search it for the word "serial". Close to that word, you should see the names of the tty devices which are used for serial port login. (Any which start with "#" have been commented out, and don't count.) On my system, I see "ttyS0" and "ttyS1" as those two devices. If /etc/inittab isn't there on your distribution, try this at the command line: Code:
grep -lr tty6 /etc 2> /dev/null Then, if you're in a script or at the command line, do this: Code:
ls -l /proc/$$/fd/0 In C or elsewhere, do the programmatic equivalent. Hope this helps. |
All times are GMT -5. The time now is 09:11 PM. |