I would like to check the authentication method (whether public key or password or both) of a bunch of IP addresses through SSH -vvv host command using a python script that does not require password.
basically I am interested in the below line of the result:
debug1: Authentications that can continue: publickey,password
process = subprocess.Popen("ssh -vvv host", shell=True,
output,stderr = process.communicate()
status = process.poll()
You could try to use
ssh -o KbdInteractiveAuthentication=no -o PasswordAuthentication=no -vvv
That instructs the client not to try keyboard interactive or password authentication, but the server will still send which methods it supports. It may still ask for confirmation if the host is unknown (could be disabled with
-o StrictHostKeyChecking=no). Maybe you'll also want to disable other authentication methods listed in the manual.
ssh -o PreferredAuthentications=none should also work