Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

System Level Login

by Anonymous Monk
on Nov 14, 2001 at 23:13 UTC ( [id://125391]=perlquestion: print w/replies, xml ) Need Help??

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

Hi all,

Just a quick question really, I have created a script which has users of my system login, but first they have to create an account. What I am wondering is whether on not I can use the data at system level to use as login, e.g. the users from the /etc/passwd file

Any ideas? Thanks all

Replies are listed 'Best First'.
Re: System Level Login
by growlf (Pilgrim) on Nov 15, 2001 at 00:55 UTC
    Try User::pwent it should do the trick. Also try getpwent.

    Since the perldoc page seems empty, here is an example of getpwent:
    ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwent() +;
    Hope that helps.

    *G*
Re: System Level Login
by perigeeV (Hermit) on Nov 15, 2001 at 03:34 UTC

    If your system supports it, look into Pluggable Authentication Modules - PAM. A quote from the Linux PAM S.A. Guide: "It is the purpose of the Linux-PAM project to separate the development of privilege granting software from the development of secure and appropriate authentication schemes. This is accomplished by providing a library of functions that an application may use to request that a user be authenticated."

    The Authen-PAM module at CPAN will help.


Re: System Level Login
by Zaxo (Archbishop) on Nov 15, 2001 at 01:02 UTC

    Creating system shell accounts may not be what you really want. If this is web based, consider whether http Basic Auth may be more appropriate.

    After Compline,
    Zaxo

Re: System Level Login
by cfreak (Chaplain) on Nov 15, 2001 at 00:45 UTC

    The short answer to your question: probably yes. I've never done it before, but it would probably involve making your script setUID root.

    BUT, that is generally considered to be a *bad thing*(tm). You most certainly wouldn't want to do it if you are planning on running this over the web or something like that.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://125391]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-20 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found