simple...
get the line which includes the user.. for example I say I'm 'Eduard' with password 'testme'
your linux userfile will look like
username:password:more info:blah:blah:blah
explode this line on ':' signs and take the first two places ([0] and [1])
now check where username = Eduard and remember this password (a string of stange charecters)
now encrypt the password this user sent ('testme')
and compare it with the password in the passwordfile.
if ($passFromFile = (encrypt($passUserSent))
{
check is ok
}