Search code examples
ubuntusshroutercisco

ssh change default authentication


when I try to access to a router with ssh enabled, it says this:

Unable to negotiate with 101.16.16.2 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

To resolve this problem, I can execute the following command to force ssh to use the authentication method that the router uses

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c aes128-cbc -l <username> 10.10.10.5

Is there any way to configure ssh to use that authentication by default. Thanks


Solution

  • You can edit the ~/.ssh/config and add the information of the host IP and ciphers. In your case, it should state:

    Host 101.16.16.2
        KexAlgorithms +diffie-hellman-group1-sha1
        Ciphers aes128-cbc