I am using this module to authenticate using pam: http://code.google.com/p/web2py/source/browse/gluon/contrib/pam.py
I can call authenticate(\'username\',\'password\
You could use sshd configuration if its a system with ssh server running and should work for root.
authenticate('root','password',service='sshd')