I need to connect to a remote host over ssh. The client doesn't support ssh key method but able to connect to remote but get disconnected with an error "no supported authentication methods available".

How do I allow only client A to be able to connect to this remote host B without using ssh keys method.

  • 1
    What package and version of SSH are the two machines running?
    – Jodie C
    Nov 11, 2012 at 1:59

3 Answers 3


You can use a Match directive in /etc/sshd_config to restrict password authentication to an IP address range or host wildcard pattern, as well as to a user or group if you like. For example, the following lines forbid password authentication except from localhost.

PasswordAuthentication no
Match Address,::1
    PasswordAuthentication yes
  • I didn't know about the Match thing. It's a fairly new thing. That solves the problem pretty neatly. Nov 12, 2012 at 3:33

If you have access to the server you can set this in sshd_config:

Match Address
PasswordAuthentication yes

Make sure this comes at the end of the file.

If you don't have access to the server then you're out of luck.

  • Yes, I do. but I need to allow this only from one source. Don't want to allow all.
    – Raza
    Nov 8, 2012 at 0:23
  • 1
    Then using two separate sshd's, and having a firewall blocking access to the second one for all hosts except the one using password authentication, would be the way to go.
    – Jenny D
    Nov 8, 2012 at 11:03
  • @salton I've updated my answer to allow from only one host.
    – bahamat
    Nov 12, 2012 at 17:53

man sshd_config is your friend, look at Match

 Match   Introduces a conditional block.  If all of the criteria on the
         Match line are satisfied, the keywords on the following lines
         override those set in the global section of the config file,
         until either another Match line or the end of the file.

         The arguments to Match are one or more criteria-pattern pairs.
         The available criteria are User, Group, Host, and Address.  The
         match patterns may consist of single entries or comma-separated
         lists and may use the wildcard and negation operators described
         in the PATTERNS section of ssh_config(5).

         The patterns in an Address criteria may additionally contain
         addresses to match in CIDR address/masklen format, e.g.
         “” or “3ffe:ffff::/32”.  Note that the mask length
         provided must be consistent with the address - it is an error to
         specify a mask length that is too long for the address or one
         with bits set in this host portion of the address.  For example,
         “” and “” respectively.
  • A bit more special information why this is useful beyond the existing answers (most notably gilles) would be useful.
    – Anthon
    Jan 3, 2014 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.