@@ -557,7 +557,8 @@ class ssh(Timeout, Logger):
557
557
558
558
def __init__ (self , user = None , host = None , port = 22 , password = None , key = None ,
559
559
keyfile = None , proxy_command = None , proxy_sock = None , level = None ,
560
- cache = True , ssh_agent = False , ignore_config = False , raw = False , * a , ** kw ):
560
+ cache = True , ssh_agent = False , ignore_config = False , raw = False ,
561
+ auth_none = False , * a , ** kw ):
561
562
"""Creates a new ssh connection.
562
563
563
564
Arguments:
@@ -571,10 +572,11 @@ def __init__(self, user=None, host=None, port=22, password=None, key=None,
571
572
proxy_sock(str): Use this socket instead of connecting to the host.
572
573
timeout: Timeout, in seconds
573
574
level: Log level
574
- cache: Cache downloaded files (by hash/size/timestamp)
575
- ssh_agent: If :const:`True`, enable usage of keys via ssh-agent
576
- ignore_config: If :const:`True`, disable usage of ~/.ssh/config and ~/.ssh/authorized_keys
577
- raw: If :const:`True`, assume a non-standard shell and don't probe the environment
575
+ cache(bool): Cache downloaded files (by hash/size/timestamp)
576
+ ssh_agent(bool): If :const:`True`, enable usage of keys via ssh-agent
577
+ ignore_config(bool): If :const:`True`, disable usage of ~/.ssh/config and ~/.ssh/authorized_keys
578
+ raw(bool): If :const:`True`, assume a non-standard shell and don't probe the environment
579
+ auth_none(bool): If :const:`True`, try to authenticate with no authentication methods
578
580
579
581
NOTE: The proxy_command and proxy_sock arguments is only available if a
580
582
fairly new version of paramiko is used.
@@ -670,6 +672,11 @@ def __init__(self, user=None, host=None, port=22, password=None, key=None,
670
672
" To remove the existing entry from your known_hosts and trust the new key, run the following commands:\n "
671
673
" $ ssh-keygen -R %(host)s\n "
672
674
" $ ssh-keygen -R [%(host)s]:%(port)s" % locals ())
675
+ except paramiko .SSHException as e :
676
+ if user and auth_none and str (e ) == "No authentication methods available" :
677
+ self .client .get_transport ().auth_none (user )
678
+ else :
679
+ raise
673
680
674
681
self .transport = self .client .get_transport ()
675
682
self .transport .use_compression (True )
0 commit comments