You are not logged in.

#1 2008-04-24 17:00:20

Bangel
Member
Registered: 2007-05-17
Posts: 45

SSH Trouble

Hey,

I have some problem with SSHD on a new archlinux install. The daemon does not start, so when I try to run it manually, it gives me this error.

Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting

Indeed, I do not have those files in the ssh directory. How can I generate them?

Offline

#2 2008-04-24 17:31:55

WhiteMagic
Member
Registered: 2007-03-01
Posts: 85

Re: SSH Trouble

Is there a reason why you start the daemon by hand instead of using the init script? If not just start it via
/etc/rc.d/sshd start
If you need to start it by hand for some reasoin, you might want to take a look at the init script file which checks for the existance of the files you mentioned and creates them if they are missing.

Offline

#3 2008-04-24 17:37:11

Bangel
Member
Registered: 2007-05-17
Posts: 45

Re: SSH Trouble

WhiteMagic wrote:

Is there a reason why you start the daemon by hand instead of using the init script? If not just start it via
/etc/rc.d/sshd start
If you need to start it by hand for some reasoin, you might want to take a look at the init script file which checks for the existance of the files you mentioned and creates them if they are missing.

Well, I DID started the server by script. However, even then the files do not exist anywhere on my system. First thing I started it by script smile

Offline

#4 2008-04-24 17:45:23

WhiteMagic
Member
Registered: 2007-03-01
Posts: 85

Re: SSH Trouble

That's odd I just checked on my system which I freshly installed and running the script created the files for me.
Anyway executig these lines taken from the script should create those files needed by sshd.

/usr/bin/ssh-keygen -t rsa1 -N "" -f /etc/ssh/ssh_host_key >/dev/null;
/usr/bin/ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key >/dev/null;
/usr/bin/ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key >/dev/null;

Offline

#5 2008-04-24 18:26:29

Bangel
Member
Registered: 2007-05-17
Posts: 45

Re: SSH Trouble

Thanks, it worked.

The only problem is, is that when I try to connect I get : Connection closed by remote host.

I use the -vv to see what's wrong and it gives me this ...

debug1: identity file /home/bangel/.ssh/identity type -1
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug2: key_type_from_name: unknown key type '-----END'

and then it identify's id_rsa to type -1 and id_dsa also to -1.

I tried to use the ssh-keygen but it gives the same error!

Offline

#6 2008-04-24 19:00:53

TheBodziO
Member
From: Dukla, Poland
Registered: 2006-07-28
Posts: 230
Website

Re: SSH Trouble

Do you have any settings in "/home/bangel/.ssh/config" file? If so they can possibly make your ssh client to use improper identity file.

Have you tried to view your key files placed in "/home/bangel/.ssh"? Maybe the're malformed (it appears so from your debug messages).

Do you have a proper public key added to ".ssh/authorized_keys" on your target machine?


It's not the best thing when they call you a "member" you know… wink

Offline

#7 2008-04-24 19:31:25

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,718
Website

Re: SSH Trouble

The only problem is, is that when I try to connect I get : Connection closed by remote host.

The solution to that problem is to edit /etc/hosts.allow and add:

sshd: xxx.xxx.xxx.xxx

where xxx.xxx.xxx.xxx are the corresponding digits of the machine you want to allow access.

You could use sshd:ALL but that is NOT wise.

Hope this helps.

R.

Offline

#8 2008-04-24 20:53:07

Bangel
Member
Registered: 2007-05-17
Posts: 45

Re: SSH Trouble

Thanks a lot, it worked, did not used the ALL but added a line for each host smile
It appears the key were good, it was the hosts.allow problem.

Offline

#9 2008-04-24 21:44:08

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,718
Website

Re: SSH Trouble

Glad it worked.
You may wont to mark this thread [solved] so other people can use it as a reference when looking for similar problems.

R.

Offline

Board footer

Powered by FluxBB