On 19/11/2010 07:55, daniele menzaghi wrote:
I need to test if a certain user credentials are valid or not.
So, given a user and password, i want to create a sh script or simply a command 
to test if his able to login into then system or not.
I even need to change the password of a certain user.
Question: the command 'passwd' accept only an intheractive password (and it's 
retype). So, how to write a sh script to change password??

There is no on interactive use of passwd - by design.

If you really have to do this you need to use expect. However it would be much better not to attempt to do this in shell script at all but in a language that allows you to call PAM directly, in particular for authentication pam_authenticate() and for password change pam_chauthtok().

This holds for Linux and FreeBSD as well as other UNIX systems too.

--
Darren J Moffat
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to