Using REAL_USER_ID

Can I use REAL_USER_ID to give me the full name of a user?

For example the user logs in with 'user1' and if you do a finger command it returns Login user1 Name: Joe Bloggs.

What I am trying to do is pass it the login name and get it to return me the Full User Name. I have searched the web and cannot find an example of how this command works.

Can anyone point me in the right direction for its correct use.

Thanks in advance

DR

Comments

  • According to the Camel book:
    The real user ID (UID) of this process as returned by the getuid syscall

    I don't fully understand that myself, but you might be able to.
  • [b][red]This message was edited by Xfactor at 2004-2-27 18:3:41[/red][/b][hr]
    : Can I use REAL_USER_ID to give me the full name of a user?
    :
    : For example the user logs in with 'user1' and if you do a finger command it returns Login user1 Name: Joe Bloggs.
    :
    : What I am trying to do is pass it the login name and get it to return me the Full User Name. I have searched the web and cannot find an example of how this command works.
    :
    : Can anyone point me in the right direction for its correct use.
    :
    : Thanks in advance
    :
    : DR

    I might not understand what you're wanting exactly but this might work for you.
    ($user,$x,$uid,$gid,$space,$space2,$name,$dir,$shell) = getpwnam $login;

    My original answer didn't work. I had to edit after I tested this. $name will have the full name, or it did for me.
    Hope this answers your question,
    X



  • Thanks for that X it did the job with a slight change

    ($user,$x,$uid,$gid,$space,$space2,$name,$dir,$shell) = getpwnam ($login);

    But it sure put me in the right direction.

    Thanks very much

    DR

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories