Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am working on a program that will need to authenticate users. We have a NIS+ system and I was looking for a simple way to get a user's shell and do stuff with their uid. Anyone have an idea?
It doesnt have to be all that simple, just working.......

20030522 Edit by Corion : Changed title from Authentication?

Replies are listed 'Best First'.
Re: Authenticating users against NIS+
by naChoZ (Curate) on May 22, 2003 at 15:18 UTC
    getpwnam and it's related commands might be what you want.

    $homedir=(getpwnam ("foo"))[7];

    This would return the home directory of user "foo" for example.

    Be more specific and give us some details though, there may be a better way to handle what you're doing.

    ~~

    naChoZ

Re: Authenticating users against NIS+
by Abigail-II (Bishop) on May 22, 2003 at 15:14 UTC
    Define "do stuff with their uid".

    Abigail

      create a few files, and adjust their contence, but I have plans for possibly extending it to a bigger framework involving quota's and fingering and so forth.
        Well, you need to be root for that.

        But do you have a specific question?

        Abigail

Re: Authenticating users against NIS+
by TVSET (Chaplain) on May 22, 2003 at 15:18 UTC
    perldoc perlfunc has a collection of functions gathered under "Fetching user and group info". If they are not what you want, then rephrase the question. :)

    Leonid Mamtchenkov aka TVSET

an adjusted version of my question
by Anonymous Monk on May 22, 2003 at 15:25 UTC
    I wish to change a few files in some users home directories, either their contence or existence on NIS+ computers. But I was going to let some users have access to a few of the pieces I create for this (adjusting .forwards and vacation messages), however, I need to verify that the person submiting the web form is who they say they are. Also because I'm stuck on a Solaris system I cannot write into a users home directory on my CGI server as the main NIS+ is not my CGI computer, so I need to get into their account and make the changes as root cannot write into remote directories in Sun NFS.
    so, I need a shell that has been authenticated for the user account to have stuff done to it on a NIS+ system.
    have I been explict enough in this write up?
      In my mind, Kerberos - a system for authenticating users and services on a network is a good solution for you. There is a Perl extension for Kerberos 5 Authen::Krb5 in the CPAN.

      Update: It isn't easy solution but, I think, that it's good and power tool for development high-quality software product which needs mechanism of authorization (for example, intranet).

            
      --------------------------------
      SV* sv_bless(SV* sv, HV* stash);
      
Re: Authenticating users against NIS+
by JoeJaz (Monk) on May 22, 2003 at 15:56 UTC
    I am working with Annonymous User to solve this NIS+ CGI Authentication problem. We found a perl module called Apache-AuthenNISPlus-0.06 and were wondering if it was of any use for this situation. In order to get this to work, we also would have to enable authentication with the .htaccess file. I'm not really sure how this is done or if this module is a worthwhile thing to look into.