[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby on linux: How to check (username,password) ?

CarmineM

1/25/2006 9:16:00 PM

Hi to everyone,

I'm writing some code to check that a password is the correct one for a
given user (in which case I need to change it to a supplied one).

As I've stated in the subject, I'm on a linux box.

Digging both in the core/standard library led me nowhere, while google
found a library named "ruby-pam".

I've downloaded and installed the library (no gem), and found that it
comes with no other documentation than the test scripts accompaining the
sources (c code).

From the test scripts, I understood that one has to provide a
"conversation function" required to talk to PAM modules.

Now, I would like to know:

1. Are there any users/examples/documentation of the abovementioned library?
2. Are there simpler alternatives?

Thanks in advance for your help.

Regards,
Carmine
2 Answers

mathew

1/26/2006 6:59:00 PM

0

CarmineM wrote:
> I'm writing some code to check that a password is the correct one for a
> given user (in which case I need to change it to a supplied one).
>
> As I've stated in the subject, I'm on a linux box.

In general, what you're hoping to do is difficult, because there are
many, many ways the password authentication could be being done.

For example, when I log in with my password, the system could be
connecting to a remote system via LDAP and checking my identity that
way. Or it could be using Kerboros.

Even the Linux passwd command may not actually correctly change the
password I log in with.

Depending on how robust you want to make the code, you may be able to
get away with what's provided in the Etc module.
<URL:http://www.ruby-doc.org/stdlib/libdoc/etc/rdoc/inde...

i.e. if you only want to deal with the /etc/passwd and /etc/shadow case,
you can probably get away with using Etc and modifying the files
directly where appropriate.


mathew
--
<URL:http://www.pobox.com/...
My parents went to the lost kingdom of Hyrule
and all I got was this lousy triforce.

CarmineM

1/26/2006 8:39:00 PM

0

Hi mathew,

mathew ha scritto:
> In general, what you're hoping to do is difficult, because there are
> many, many ways the password authentication could be being done.
>
> For example, when I log in with my password, the system could be
> connecting to a remote system via LDAP and checking my identity that
> way. Or it could be using Kerboros.
>
> Even the Linux passwd command may not actually correctly change the
> password I log in with.

Hmm, I see.

> Depending on how robust you want to make the code, you may be able to
> get away with what's provided in the Etc module.
> <URL:http://www.ruby-doc.org/stdlib/libdoc/etc/rdoc/inde...
>
> i.e. if you only want to deal with the /etc/passwd and /etc/shadow case,
> you can probably get away with using Etc and modifying the files
> directly where appropriate.

Well, the system which I use have shadow password and is joined with a
Windows 2003 domain.

The passwords I want to change are for the emails (and, maybe, later for
the domain accounts).

I've already poked at Etc module, and it seems to deal only with
/etc/passwd. More, it doesn't look like it provides a mechanism to
confront provided and stored password, or to alter them.

Regards,