Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
How to check user name and password for Linux accounts
Zhao Yi
1/8/2009 3:41:00 AM
Can ruby check user name and password the same way as Linux OS? I use
"ypcat passwd" to list all users and its encrypted password. I want
users to input their user name and password to ruby and let ruby the
check its validation.
thanks.
--
Posted via
http://www.ruby-...
.
3 Answers
Roger Pack
1/8/2009 6:23:00 AM
0
Zhao Yi wrote:
> Can ruby check user name and password the same way as Linux OS? I use
> "ypcat passwd" to list all users and its encrypted password. I want
> users to input their user name and password to ruby and let ruby the
> check its validation.
>
> thanks.
You may be able to find a wrapper to crypt(3) or whatever your system
uses to generate the hashes in the passwd file. Or a pure ruby one.
-=r
--
Posted via
http://www.ruby-...
.
Matt Harrison
1/8/2009 7:10:00 AM
0
Zhao Yi wrote:
> Can ruby check user name and password the same way as Linux OS? I use
> "ypcat passwd" to list all users and its encrypted password. I want
> users to input their user name and password to ruby and let ruby the
> check its validation.
>
> thanks.
If your system uses PAM, like most modern linux distros, you might want
to look at Ruby/PAM[1]
I haven't tried it but a quick look through the examples seems like it
could work for you.
[1]
http://ruby-pam.sourceforge.net/pam...
HTH
Matt
Brian Candler
1/8/2009 9:47:00 AM
0
If you have the encrypted passwords from ypcat, then they are easy to
check.
irb(main):002:0> enc_pw = "aauZSSiXB7FbU"
=> "aauZSSiXB7FbU"
irb(main):003:0> "ruby".crypt(enc_pw) == enc_pw
=> true
irb(main):005:0> enc_pw = "$1$aaaa$jM9byC6tzuk.OYACuTQrJ/"
=> "$1$aaaa$jM9byC6tzuk.OYACuTQrJ/"
irb(main):006:0> "ruby".crypt(enc_pw) == enc_pw
=> true
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
How to check user name and password for Linux accounts
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password