LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-04-2005, 05:31 PM   #1
jrtayloriv
Member
 
Registered: Jun 2004
Location: Inland NW, US
Distribution: Ubuntu
Posts: 365
Blog Entries: 1

Rep: Reputation: 44
sshd keys


I am trying to get sshd up and running, but can't get it to accept my host keys.

I created them using ssh-keygen:

ssh-keygen -t dsa
ssh-keygen -t rsa

copied the private keys from my home/.ssh dir to /etc/ssh/ssh_host_dsa_key and /etc/ssh/ssh_host_rsa_key:

cp ~/.ssh/id.rsa /etc/ssh/ssh_host_rsa_key
cp ~/.ssh/id.dsa /etc/ssh/ssh_host_dsa_key

chmodded them too 600 and ran sshd. And I get this:

bash-2.05b# sshd
Could not load host key: /etc/ssh/ssh_host_key
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.

Everywhere I go, instructions tell me to do exactly what I did above? What could be the problem?

Thanks,
jrtayloriv
 
Old 01-04-2005, 06:23 PM   #2
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 35
Your public key goes in the home dir of the machine you are going to. You are confusing host based keys with personal keys.

Host based keys are generated by deleting the old ones from the /etc/ssh directory and then simply restating the ssh daemon.

Personal authentication is done as such:

machine a
ssh-keygen -t rsa
(go thru the dialogs of where ya wanna save it, etc

Now, if you have an account on machine b, you would

ssh machineb mkdir ~/.ssh
(enter your password for the account there)
(assuming tghere isn't a .ssh dir on that machine)

scp ~/.ssh/id-rsa.pub machineb:~/.ssh/authorized_keys
(you are prompted for password)

after file is there, password is not needed.
 
Old 01-04-2005, 06:38 PM   #3
jrtayloriv
Member
 
Registered: Jun 2004
Location: Inland NW, US
Distribution: Ubuntu
Posts: 365
Blog Entries: 1

Original Poster
Rep: Reputation: 44
?

maybe I misunderstood something in your post....or maybe I was not clear enough about my problem in mine...

I don't have a machine that is running sshd yet, so how am I to use ssh to connect to one using the other? The problem is that sshd will not start. It is when I try to start the ssh daemon that I get this error message. I did as you said and removed the host keys from the /etc/ssh directory and got the same error message (i.e. it would not start sshd, because it can't load host keys). Anything else that might be wrong?

Thanks
jrtayloriv
 
Old 01-04-2005, 07:14 PM   #4
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 35
when the keys are gone, you need to generate new ones by restarting the daemon

/etc/init.d/sshd restart

That generates new host based keys

That isn't working for you?
You shud see output while the keys are being made.
.
 
Old 01-04-2005, 07:29 PM   #5
jrtayloriv
Member
 
Registered: Jun 2004
Location: Inland NW, US
Distribution: Ubuntu
Posts: 365
Blog Entries: 1

Original Poster
Rep: Reputation: 44
Talking working

Thanks for the help, that was what I was looking for!
 
Old 02-25-2005, 03:35 PM   #6
edafe
Member
 
Registered: Feb 2005
Posts: 44

Rep: Reputation: 15
Step-by-step instructions on how to use public key authentication with SSH:

http://www.edafe.org/slackware/index...authentication

Regards,
Edafe
 
Old 03-14-2005, 06:43 PM   #7
jaknowlden
LQ Newbie
 
Registered: Mar 2005
Distribution: fedora core 3
Posts: 2

Rep: Reputation: 0
I found this in my rc.sshd

# Create host keys if needed.
if [ ! -r /etc/ssh/ssh_host_key ]; then
/usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N ''
fi
if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
/usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
fi
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
/usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
fi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Quiet sshd using keys Kdr Kane Linux - Security 7 08-30-2005 12:54 PM
YUM requires public keys, how do I get public keys? GNUROCKS Linux - Newbie 3 05-29-2005 09:50 AM
with keys is the keys that change languages? AKAKAK Fedora 2 01-25-2005 11:11 AM
Enabling SSH in mandrake 9.2 - sshd vs. sshd-xinetd DogTags Linux - Newbie 7 11-25-2003 01:17 PM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 04:31 AM


All times are GMT -5. The time now is 07:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration