Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
1  
What package and version of SSH are the two machines running? –  JodieC Nov 11 '12 at 1:59
add comment

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 127.0.0.1,::1
    PasswordAuthentication yes
share|improve this answer
    
I didn't know about the Match thing. It's a fairly new thing. That solves the problem pretty neatly. –  Omnifarious Nov 12 '12 at 3:33
add comment

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

Match Address 198.51.100.37
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.

share|improve this answer
    
Yes, I do. but I need to allow this only from one source. Don't want to allow all. –  Raza Nov 8 '12 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 '12 at 11:03
    
@salton I've updated my answer to allow from only one host. –  bahamat Nov 12 '12 at 17:53
add comment

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.
         “192.0.2.0/24” 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,
         “192.0.2.0/33” and “192.0.2.0/8” respectively.
share|improve this answer
    
A bit more special information why this is useful beyond the existing answers (most notably gilles) would be useful. –  Anthon Jan 3 at 8:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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