[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Check whether the user is local user



On Wed, May 24, 2000 at 02:43:04PM +0800, Wan Hing Wah wrote
> Is it any method that I can check whether the user is a local user 
> (that mean use the computer by sitting in front of the computer
> physically).It maybe useful so that I can make a program which is setuid
> to root and check whether the user is local and grant permission to
> some physical device...
> 

The best way of verifying that a user is actually sitting at the
console is to check the name of their controlling tty to ensure that
it is set and is a regular tty and not a pty.
This is how the Debian X startup scripts do it.

It's not foolproof (it won't work if they are running screen/
in X/telnet localhost/ etc.), but it should never give a false
positive.

How to identify the controlling tty is left as an exercise for
the reader...



John P.
-- 
huiac@camtech.net.au
john@huiac.apana.org.au
http://www.mdt.net.au/~john Debian Linux admin & support:technical services



Reply to: