LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-21-2007, 10:29 AM   #1
powah
Member
 
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Rep: Reputation: 30
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?

Last edited by powah; 09-21-2007 at 10:32 AM.
 
Old 09-22-2007, 08:16 PM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
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
and look through the resultant list for the appropriate file.

Then, if you're in a script or at the command line, do this:
Code:
ls -l /proc/$$/fd/0
and see whether the device named in the symbolic link matches one of the serial login devices.

In C or elsewhere, do the programmatic equivalent.

Hope this helps.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Using an Apple IIe as a serial term with Gentoo Linux LXer Syndicated Linux News 0 07-16-2007 10:16 PM
linux serial port to router console port connection? frankie_fix Linux - General 3 02-26-2007 09:32 PM
Using serial port card(PCMCIA) with IPAQ running Linux, can't find ttyS0 port d2army Linux - Laptop and Netbook 0 11-12-2005 08:07 PM
Windows to linux via serial port longnam Linux - Hardware 2 04-30-2005 02:07 PM
Installing Linux Over Serial Port NLess Linux - General 7 01-24-2003 02:44 PM


All times are GMT -5. The time now is 01:44 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration