how to check if I'm allowed to ssh several hosts.

Hi guys!

I'm working on a little script. I have a txtfile with several hosts, Unix team has copied my keys into several of those servers, but not all of them, I need to figure out which ones I don't have access to, (I want a list of servers I don't have access to, so I can request for it). This is the script I have so far. Please BASH scripts.

#!/bin/bash

while read line
do
ssh -q userx@$line exit;
echo $?;
echo $line;

done < $1

This one is not working, after the second server the script stops.

Hi.

Try adding a -n option to your ssh command.