script detecting ssh password request
hi,
i've been thinking about this for a few days now, and cant find the way to do this.
We're using an api to copy files to the target servers.
We have public key is on the servers, but sometimes (due to overload, unstable ssh version, or whatever) we get "connection refused". If we keep trying, it will eventually work. Also, for the users that don't have the key, i would like to display some error message. So basically, we have a web page to do some stuff, but if in the backgroup we get "connection refused" or the "password" question, i would like to be able to detect that.
I don't want to install expect. Is there a simple way to catch that filehandler (fh 4)?
The only way i've thought of so far is to spawn in the background another process that ssh to the servers, wait a second or so, and look if that process is still there. If it is, it means it was asked for a password. Thats not very elegant tho.
sorry for my poor english/communication.
jp
|