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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -