SSH host-based authentication

I have a client and a server which are both based on Slackware (version 10.2.0 / kernel 2.6.15.4). I want to connect form the client to the server with ssh host-based authentication. That's what I have done so far. Of course I have an entry in /etc/hosts for each machine (client and IP on server; server and IP on client).

Client:
vim /etc/ssh/ssh_config -> EnableSSHKeySign yes, HostbasedAuthentication yes
ssh-keyscan server >> /etc/ssh/ssh_known_hosts
/etc/rc.d/rc.sshd stop
/etc/rc.d/rc.sshd start

Server:
vim /etc/ssh/sshd_config -> HostbasedAuthentication yes, IgnoreRhosts no
touch /etc/ssh/shosts.equiv
vim /etc/ssh/shosts.equiv -> client root
ssh-keyscan client >> /etc/ssh/ssh_known_hosts
touch ~/.shosts -> client root
/etc/rc.d/rc.sshd stop
/etc/rc.d/rc.sshd start

When I try to ssh from my client on server with

ssh server

I receive the following error:

get_socket_address: getnameinfo 8 failed: Name or service not known userauth_hostbased: cannot get local ipaddr/name

The whole log with verbose ssh is:

OpenSSH_4.2p1, OpenSSL 0.9.7g 11 Apr 2005
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to server [192.168.1.102] port 22.
debug1: Connection established.
debug1: read PEM private key done: type DSA
debug1: read PEM private key done: type RSA
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_4.2
debug1: match: OpenSSH_4.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'server' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive,hostbased
debug1: Next authentication method: hostbased
get_socket_address: getnameinfo 8 failed: Name or service not known
userauth_hostbased: cannot get local ipaddr/name
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive,hostbased
debug1: Next authentication method: password
root@server's password: 

My /etc/hosts on the client looks like this:

127.0.0.1 localhost
127.0.0.1 client.local client

192.168.1.101 client
192.168.1.102 server

and the /etc/hosts on the server like this:

127.0.0.1 localhost
127.0.0.1 server.local server

192.168.1.101 client
192.168.1.102 server

1 answer

  • answered 2020-09-28 13:36 confused genius

    Remove client from "127.0.0.1 client.local client" in /etc/hosts file on client machine as following :

    127.0.0.1 localhost
    127.0.0.1 client.local 
    
    192.168.1.101 client
    192.168.1.102 server
    

    Remove 'server' from "127.0.0.1 server.local server" in /etc/hosts file on sever as following :

    127.0.0.1 localhost
    127.0.0.1 server.local 
    
    192.168.1.101 client
    192.168.1.102 server