Hi Maxim,
Apart from the discussion about the session timeout on the CLI and the script you wrote, depending on what password you're trying to change, ACS offers already some options which may help in your case.
So, are you trying to allow for password change for users on the ACS internal DB or for the ACS admin accounts?
You may look at the admin password lifetime config here:
https://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.1/user/guide/admin_admin.html#wp1074571
Or for the changing the password on for the internal users, please check the UCP Web Service details here:
https://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.1/sdk/ucp.html
I hope this helps.
Regards,
Federico
--
If this answers your question please mark the question as "answered" and rate it, so other users can easily find it.