Get login name differences in this case...
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Get login name differences in this case...




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Get login name differences in this case...  
K-mart Cashier


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-11-07 06:21 AM

What's the difference between using

struct passwd *getpwuid(uid_t uid);

vs

reading utmp  to get name of the person currently logged on?


Thanks in advance
Chad






[ Post a follow-up to this message ]



    Re: Get login name differences in this case...  
Kurt M. Weber


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-11-07 06:21 AM

K-mart Cashier wrote:

> What's the difference between using
>
> struct passwd *getpwuid(uid_t uid);
>
> vs
>
> reading utmp  to get name of the person currently logged on?


utmp is unreliable (see utmp(5) for an explanation).

--
Kurt M. Weber
<kmw@armory.com>





[ Post a follow-up to this message ]



    Re: Get login name differences in this case...  
K-mart Cashier


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-11-07 06:21 AM

On Jul 10, 8:19 pm, "Kurt M. Weber" <k...@armory.com> wrote:
> K-mart Cashier wrote: 
> 
> 
> 
>
> utmp is unreliable (see utmp(5) for an explanation).
>
> --
> Kurt M. Weber
> <k...@armory.com>


On the Linux utmp(5), I don't see anyting that would say utmp is
unreliable.  Maybe I'm not looking at utmp(5) close enough.

Chad






[ Post a follow-up to this message ]



    Re: Get login name differences in this case...  
Barry Margolin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-11-07 06:21 AM

In article <1398j2g7224co6c@corp.supernews.com>,
"Kurt M. Weber" <kmw@armory.com> wrote:

> K-mart Cashier wrote:
> 
>
>
> utmp is unreliable (see utmp(5) for an explanation).

If there are multiple usernames that map to the same UID, which of the
two methods will give the one that was actually used at login time?

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***





[ Post a follow-up to this message ]



    Re: Get login name differences in this case...  
Barry Margolin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-11-07 06:21 AM

In article <1184129411.938641.215930@x35g2000prf.googlegroups.com>,
K-mart Cashier <cdalten@gmail.com> wrote:

> On Jul 10, 8:19 pm, "Kurt M. Weber" <k...@armory.com> wrote: 
>
> On the Linux utmp(5), I don't see anyting that would say utmp is
> unreliable.  Maybe I'm not looking at utmp(5) close enough.

I don't see it in the OS X man page, either.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***





[ Post a follow-up to this message ]



    Re: Get login name differences in this case...  
Kurt M. Weber


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-11-07 06:22 PM

K-mart Cashier wrote:

>
> On the Linux utmp(5), I don't see anyting that would say utmp is
> unreliable.  Maybe I'm not looking at utmp(5) close enough.
>
> Chad

*DESCRIPTION*
The utmp file allows one to discover information about who is
currently using the system.  There may be more users currently using the
system, because not all programs use utmp logging.

It also doesn't include logins done via xdm, since XDM login sessions aren't
assigned to a particular terminal.

Furthermore, the format for utmp varies from platform to platform.  Chances
are your code won't be portable.

--
Kurt M. Weber
<kmw@armory.com>





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:12 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register