Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Unix Password for validation

by radiantmatrix (Parson)
on Nov 17, 2005 at 18:18 UTC ( [id://509512]=note: print w/replies, xml ) Need Help??

in reply to Unix Password for validation

Depending on your UNIX flavor, you might have the Pluggable Authentication Module available. If you do, this is incredibly simple using Authen::SimplePam:

use Authen::SimplePam; my $auth = Authen::SimplePam->new(); my $result = $auth->auth_user($username, $password, 'login'); if ( $result == 1 ) { print 'User logged in OK!' } else { print 'Login failed: ',$auth->result2string($result); }

If you are doing this without the benefit of PAM, it could be trickier.

As for security issues, what you really want to do is not send things over clear text -- this means FTP is a poor choice. Try SSH or another secure protocol. Also, your approach of logging in once and then allowing access based on the result code is probably not the best. With something like PAM available, it would be best to actually authenticate each operation that needs privileges.

Unfortunately, that's all the more specific I can be with such a vague question.

A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law

Replies are listed 'Best First'.
Re^2: Unix Password for validation
by sara2005 (Scribe) on Nov 17, 2005 at 19:59 UTC

    Thanks for the suggestion.

    I was able to install PAM module and the authentication worked fine except that I also got a message

    Subroutine PAM_BINARY_PROMPT redefined at ~/perllib/Authen/ : line 56

    Sorry that I was not clear in the initial post. I intend to have every page and operation validated by calling this function before doing anything.

    Thanks again for your help

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://509512]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-13 23:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found