At the moment, I think your best bet is to pass the hashed password to the client, instead of the plaintext one.
Locally, hash the password with
hashpass=openssl passwd -1 -salt sssss ppppppppppp
Then tell the remote client
usermod -p $hashpass username
where sssss
is a random salt, ppppppppppp
is the desired password, and username
is the user whose password is to be reset. Ensuring the correct passage of $hashpass
is also something you will need to attend to.
If you run the openssl
command on the command line, you'll see how it returns a hashed password string rather than the plaintext password. This is still not completely secure, but a lot better than having a plaintext password on the CLI. I also note that this uses md5
hashing, which is considered weak. I can't currently find a way of producing a sha
-hashed password from the command line; if you can, that would be better.