How to permit one sub admin to change passwords of other certain users? I'ld like to make a sub admin be able to change other user's passwords depending on other user's role or uid.

The sub admin should be able to type the password by himself. Emailing a generated password is unfortunatley no optionn since the aimed user accounts will be used by a quite loose group of people (teachers and pupils, sub admin wants to change password every school year).

Until now there are only very few different accounts where that needs to happen. So can I maybe do that with uids?

Is it maybe possible to build a block that provides a form with password fields of the desired users? What hooks or forms would I need to use or alter then?

Any idea and/or explanation is very much appreciated!
Thanks to arpitr and my coworker J., I finally did it with a form on a page which is accessible only to selected roles via hook_permission(). The desired array() of uid=&gt;name of that certain role to pass on as select list #option comes from db_select(), which definitely was the most difficult thing to get:

function _get_users_by_role($role_name) {
  $query = db_select('users', 'u')
    -&gt;fields('u', array('uid', 'name'));

  $query-&gt;innerJoin('users_roles', 'ur', 'u.uid = ur.uid');
  $query-&gt;innerJoin('role', 'r', 'ur.rid = r.rid');
  $query-&gt;condition('r.name', $role_name);

  $result = $query-&gt;execute()-&gt;fetchAllKeyed();

  return ($result) ? $result : array();
}


For those interested in the custom block approach arpitr proposed, check the accepted answer on How can I display a change password form on its own? for a even more detailed description.