It is too risky to do it like this because you will have to pass the new password somewhere to view and doing this may be a bit risk in terms of security. You may end up losing the password too. However, if you want to do something security wise, I would suggest using an SSH key and disable the password authentication, so there will be no need to have the SSH password to be changed again and again.