WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [solved] openssh keeps generating new private/public keys on every boot  (Read 23273 times)

Offline gtr2

  • WikiUser
  • *
  • Posts: 19
Hi there,
I must have spent a fairly long time trying to figure out what the problem might be but to no avail.
The steps so far ...
tce-load -iw openssh.tcz
sudo cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
sudo cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config

I made the lot persistent:
nano /opt/.filetool.lst
usr/local/etc/ssh/sshd_config
usr/local/etc/ssh/ssh_config

Making openssh start on boot:
nano /opt/bootlocal.sh
/usr/local/etc/init.d/openssh start

The backup
filetool.sh -b
... or just
backup

I disabled password authentication in sshd_config. Why does openssl keep on generating private/public keys on every boot ?
I can't login to my Raspberry Pi using ssh
Permission denied (publickey,keyboard-interactive)

Any advice?
Thanks in advance.

PS: Using the <code> tag was not possible as I was continuously getting " Sorry, you are not allowed to post external links." error.
« Last Edit: May 27, 2013, 02:22:34 AM by gtr2 »

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: openssh keeps generating new private/public keys on every boot
« Reply #1 on: May 26, 2013, 01:36:08 AM »
Add the 6 generated keys to your backup.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gtr2

  • WikiUser
  • *
  • Posts: 19
Re: openssh keeps generating new private/public keys on every boot
« Reply #2 on: May 26, 2013, 01:53:44 AM »
Thanks bmarkus but I had already done that, I made the following entries in opt/.filetool.lst:

usr/local/etc/ssh/ssh_host_dsa_key.
usr/local/etc/ssh/ssh_host_dsa_key.pub.
usr/local/etc/ssh/ssh_host_ecdsa_key.
usr/local/etc/ssh/ssh_host_ecdsa_key.pub.
usr/local/etc/ssh/ssh_host_rsa_key.
usr/local/etc/ssh/ssh_host_rsa_key.pub.

... and made a backup as well.

openssh keeps generating keys on every boot though

I have openssh running on Debian and Arch without any problem.
« Last Edit: May 26, 2013, 01:56:18 AM by gtr2 »

Offline Gerrelt

  • Full Member
  • ***
  • Posts: 176
Re: openssh keeps generating new private/public keys on every boot
« Reply #3 on: May 26, 2013, 02:24:56 AM »

Try adding a "/" before the paths, like this:


/usr/local/etc/ssh/ssh_host_dsa_key.
/usr/local/etc/ssh/ssh_host_dsa_key.pub.
/usr/local/etc/ssh/ssh_host_ecdsa_key.
/usr/local/etc/ssh/ssh_host_ecdsa_key.pub.
/usr/local/etc/ssh/ssh_host_rsa_key.
/usr/local/etc/ssh/ssh_host_rsa_key.pub.

And are you sure the dot is supposed to be there at the end of the path ( I don't have any experience with openssh, I use dropbear)?
my Raspberry Pi page: http://raspberry.gerrelt.nl

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: openssh keeps generating new private/public keys on every boot
« Reply #4 on: May 26, 2013, 02:29:10 AM »
In you mail you mentione only config file backup, not the keys. Sharing the whole file would have saved some time for us.

Referring to Debian or Arch is irrelevant. Core is not a derivate of them.

Finally, do not use a leading / in filetool.lst and remove . at the end.

It works here as expected.
« Last Edit: May 26, 2013, 02:30:50 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gtr2

  • WikiUser
  • *
  • Posts: 19
Re: openssh keeps generating new private/public keys on every boot
« Reply #5 on: May 26, 2013, 02:59:17 AM »
@ Gerrelt
I had already tried with and without the leading forward slash but to no avail
The culprit was the dot at the end of the lines.

@ bmarkus
All apologies, yes I should have posted the way you've just mentioned.
Sorted! I deleted the dot at the end of every line and now it's OK.

However, I'm still not able to connect to my RPi using SSH as I'm still getting the following error:
Permission denied (publickey,keyboard-interactive)
I guess I need to use one of those keys on my computer if I'm not mistaken? If so, how should I proceed?
Is there any way I could just disable to login based on those keys ?

PS: I was referring to Debian and Arch because I can easily login to my RPi without all those keys ( those weren't mandatory )
« Last Edit: May 26, 2013, 03:01:57 AM by gtr2 »

Offline Gerrelt

  • Full Member
  • ***
  • Posts: 176
Re: openssh keeps generating new private/public keys on every boot
« Reply #6 on: May 26, 2013, 03:19:59 AM »
Finally, do not use a leading / in filetool.lst.

Hi bmarkus,
 
What's the reason behind this? Could you explain?

Greetings,

    Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: openssh keeps generating new private/public keys on every boot
« Reply #7 on: May 26, 2013, 04:15:27 AM »
That's simply how syntax of tar list works.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: openssh keeps generating new private/public keys on every boot
« Reply #8 on: May 26, 2013, 05:26:36 AM »
However, I'm still not able to connect to my RPi using SSH as I'm still getting the following error:
Permission denied (publickey,keyboard-interactive)
I guess I need to use one of those keys on my computer if I'm not mistaken? If so, how should I proceed?
Is there any way I could just disable to login based on those keys ?

It is neither clear what you are trying to achieve nor why you are using openSSH (which is much more complicated than dropbear).
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline gtr2

  • WikiUser
  • *
  • Posts: 19
Re: openssh keeps generating new private/public keys on every boot
« Reply #9 on: May 26, 2013, 05:57:16 AM »
It is neither clear what you are trying to achieve nor why you are using openSSH (which is much more complicated than dropbear).
Well, I'm just trying to login to my RPi from my computer using Kitty or MobaXterm. I  don't feel like using Dropbear because I need SFTP and that's exactly the reason why I've always run openssh without any problems.
Sorry if these questions seem elementary to you experts but I'm trying hard to learn.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: openssh keeps generating new private/public keys on every boot
« Reply #10 on: May 26, 2013, 06:06:44 AM »
Did you set passwd for tc or added a new user?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: openssh keeps generating new private/public keys on every boot
« Reply #11 on: May 26, 2013, 06:20:27 AM »
Well, I'm just trying to login to my RPi from my computer using Kitty or MobaXterm. I  don't feel like using Dropbear because I need SFTP and that's exactly the reason why I've always run openssh without any problems.

That doesn't explain
Quote
I disabled password authentication in sshd_config.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline gtr2

  • WikiUser
  • *
  • Posts: 19
Re: openssh keeps generating new private/public keys on every boot
« Reply #12 on: May 26, 2013, 08:28:03 AM »
Did you set passwd for tc or added a new user?
I set a password for tc.
Well, SFTP connection is working flawlessly by now. I must have done something wrong but after a new installation, things are looking all right.
Thanks a lot for your support :)

Offline gtr2

  • WikiUser
  • *
  • Posts: 19
Re: openssh keeps generating new private/public keys on every boot
« Reply #13 on: May 26, 2013, 08:31:59 AM »
That doesn't explain
Quote
I disabled password authentication in sshd_config.
Well, I reset password authentication to yes but that wasn't the sole issue. I've fixed the problem now.
Thank you very much ;)

Offline xyz-worx

  • Jr. Member
  • **
  • Posts: 62
Re: openssh keeps generating new private/public keys on every boot
« Reply #14 on: May 27, 2013, 12:53:49 AM »
Hi gtr2,

it's a good idea to give a short description, what else you did to resolve your problem.
It might help other user having similar troubles. Additionally you might mark this thread
as [SOLVED].

thanx

xyz-worx