python - Check if user is asked for a password during ssh -
i want know if there's way in python can detect if user asked password when connecting sftp using ssh, able ignore connecting?
thanks.
i not aware such thing possible python; anyway wouldn't recommend involving checking password interactive prompts if try filter subprocess pipes (in case calling sftp popen).
if goal prevent password authentication may call sftp passwordauthentication=no
, preferredauthentications=publickey
this:
sftp -o passwordauthentication=no -o preferredauthentications=publickey host
in way should fail if password required.
Comments
Post a Comment