The PreferredAuthentications=publickey option worked, but thanks for this tip as well. :)
On 20 Apr 2010, at 21:18, emf@amhran.net wrote:
>> On Mon, Apr 19, 2010 at 02:16:46PM +0100, Jannik Sundø wrote:
>>> I'm writing a script which will log into a list of servers if they
>>> have public/private keypairs set up. If a server doesn't, I want the
>>> script to move on to the next server rather than wait at a password
>>> prompt.
>>>
>>> I'm using this command:
>>> ssh root@IP -o PasswordAuthentication=no KbdInteractiveAuthentication=no
>
> Found elsewhere on the web and modified.... in bash,
>
> ( ssh root@IP -o PasswordAuthentication=no KbdInteractiveAuthentication=no
> ) & sleep 5 ; kill $!
>
> Assuming whatever you're doing on the list of servers will take 5 seconds
> to complete and continue.. if not, replace the 5 in the sleep with however
> long it will take to complete the task.
>
> If it hangs at a password prompt, it'll only hang for the sleep timer and
> then continue on.
Jannik Sundø
Junior Network Engineer
Sohonet Limited
http://www.sohonet.co.uk Registered no. 3132110 England/Wales
t: +44 (0)20 7292 6900
f: +44 (0)20 7292 6901
24/7 support:
UK: +44 (0)20 7292 6909
US: +001 310 449 8610
AU: 1800 77 5280
The information in this email may contain confidential and/or privileged material. Any copying, dissemination or other use by any person other than the intended recipient is prohibited. If you have received this email in error, please contact the sender and delete the material from your computer. Thank you.