?
Solved

Removing and reinstalling SSH

Posted on 2005-05-16
9
Medium Priority
?
652 Views
Last Modified: 2013-12-06
I’ve been trying to remotely connect via ssh with no password for a while now – I think ive managed to figured out how to do it now, but in the process of sorting it out I think ive removed things that I wasn’t supposed to.

For example

Now when I connect from Comp1 to Comp2 ssh [ip address] I get this error message: Host key verification failed.

And when I connect from Comp2 to Comp1 ssh [ip address] I get this error message: ssh_exchange_identification: Connection closed by remote host.

I’ve removed everything out of the /~ssh directory on both machines.

I want to basically reinstall openssh and start again. What’s the best way around it? I’ve tried rpm –e opensshpackagename.rpm but it has a few dependencies such as
openssh-server,
openssh-client,
openssh-askpass
openssh-askpass-gnome.

Im running Fedora Core 3.

What’s the best way of tackling the problem?

Thanks


0
Comment
Question by:the_omnific
  • 5
  • 4
9 Comments
 
LVL 15

Expert Comment

by:DonConsolio
ID: 14009433
remove $HOME/.ssh/known_hosts
0
 
LVL 1

Author Comment

by:the_omnific
ID: 14009683
I have done already on both machines
0
 
LVL 15

Expert Comment

by:DonConsolio
ID: 14010090
try  "ssh -v Comp2" and check output (or post here if you do not understand it)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:the_omnific
ID: 14010132
Comp1 to Comp2

[root@Test documents]# ssh -v 192.168.0.3
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Applying options for *
debug1: Connecting to 192.168.0.3 [192.168.0.3] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type 0
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_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.9p1
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
Host key verification failed.
0
 
LVL 1

Author Comment

by:the_omnific
ID: 14010162
Comp 2 to Comp 1

[root@FILESERVER ~]# ssh -v 192.168.0.90
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.0.90 [192.168.0.90] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type 0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host
[root@FILESERVER ~]#

0
 
LVL 15

Expert Comment

by:DonConsolio
ID: 14010268
looks like you deleted your ssh host key

either reinstall the rpm with the "--nodepends" option (or with "--force" if needed)

or regenerate your host key

example code:
        if ! test -f /etc/ssh/ssh_host_key ; then
            echo Generating /etc/ssh/ssh_host_key.
            ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N ''
        fi
        if ! test -f /etc/ssh/ssh_host_dsa_key ; then
            echo Generating /etc/ssh/ssh_host_dsa_key.
            ssh-keygen -t dsa -b 1024 -f /etc/ssh/ssh_host_dsa_key -N ''
        fi
        if ! test -f /etc/ssh/ssh_host_rsa_key ; then
            echo Generating /etc/ssh/ssh_host_rsa_key.
            ssh-keygen -t rsa -b 1024 -f /etc/ssh/ssh_host_rsa_key -N ''
        fi
0
 
LVL 1

Author Comment

by:the_omnific
ID: 14010914
i removed the ssh directory and used the rpm -vi --force openssh-3.9p1-7.i386.rpm, rpm -vi --force openssh-clients-3.9p1-7.i386.rpm, rpm -vi --force openssh-server-3.9p1-7.i386.rpm commands... and im still getting:

[root@Test documents]# ssh -v 192.168.0.3
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.0.3 [192.168.0.3] port 22.
debug1: Connection established.
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
ssh_exchange_identification: Connection closed by remote host

?
0
 
LVL 15

Accepted Solution

by:
DonConsolio earned 750 total points
ID: 14012780
try rebuilding your host keys
(if you don't know the location check "/etc/ssh/sshd_config"

e,g,
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
0
 
LVL 1

Author Comment

by:the_omnific
ID: 14025474
to be honest i didn't really know how to rebuild the hostkeys so i simply loaded Fedora on another machine and copied the /etc/ssh directory across to both machines and everything is configured fine. thanks for your prompt responses
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month15 days, 3 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question