LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (https://www.linuxquestions.org/questions/%2Absd-17/)
-   -   Strange ssh problem (https://www.linuxquestions.org/questions/%2Absd-17/strange-ssh-problem-166180/)

Inexactitude 04-04-2004 04:45 PM

Strange ssh problem
 
I was having problems with my sendmail server, but when I fixed the problem, I startedd getting strange emails in my root users mailbox. The messages read like this:

Quote:

From operator@blah(Cron Daemon)
To operator@blah
Subject Cron <operator@blah> /usr/libexec/save-entropy

Could not load host key: /usr/local/etc/ssh_host_key
Could not load host key: /usr/local/etc/ssh_host_rsa_key
Could not load host key: /usr/local/etc/ssh_host_dsa_key
Disabling protocol version 1. Could not load host key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.
So I'm getting about 100 of these a day. So what I did was chmod 777 /usr/local/etc/ssh_host_key and the rest (I know that this isn't a safe practice). The emails stop coming, but now I get "failed to bind to address" errors from ssh about every 5 - 15 minutes. So I chmod 700 the keys again, and the emails start coming again, but no more errors from ssh. I don't think that this is much of a big deal, but I would like to know why this is happening all of a sudden.

By the way, the ssh server was working correctly the whole time it seemed.

Thanks for any help.

chort 04-04-2004 06:42 PM

I assume you're using FreeBSD (you don't say in your post, so I'm guessing from the side bar and from your problem). /usr/local/etc is used by the ports version of SSH, SFAIK. I think the builtin version uses the standard /etc/ssh directory. Are you sure it's not trying to start two SSH daemons? That would seem to be the problem, since you got "failed to bind to address" (which is probably because there's already an SSH daemon listening).

If you're using the base system version of SSH, then you should disable the ports version. There should be some startup scripts in /usr/local/etc/something (rc?). Move the SSH script to being "hidden" so that it's not started (mv ssh-script .ssh-script), then kill the SSH daemon that's starting from /usr/local directory (ps aux |grep ssh |grep /usr/local, then kill the PID).

Absolutely do NOT make the SSH key files world writeable. You will get you could potentially have a trivial compromise. No system daemon should ever require having it's files be world writeable, so that should never be part of your troubleshooting. In particular, the system keys for SSH should all be 600 (that's the private keys).

Inexactitude 04-05-2004 01:37 PM

Okay, I fixed the problem. All I had to do was to do 'ssh_enable= "NO"' in my rc.conf. I wonder why this problem started happening in the first place though, because I don't remember doing anything to provoke it, and this hasn't been happening even though i've been running the ports version of sshd with the base one killed, and had ssh_enable = "YES" in rc.conf the whole time anyway. Strange....

Thanks for the help.


All times are GMT -5. The time now is 06:47 PM.