WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline gtr2

  • WikiUser
  • *
  • Posts: 19
Re: openssh keeps generating new private/public keys on every boot
« Reply #15 on: May 27, 2013, 02:21:34 AM »
@ xyz-worx
Yes mate, I was about to do it anyway, sorry. So here we go then ....

A fresh copy of piCore
Code: [Select]
fdisk -ul
Code: [Select]
mount  /dev/mmcblk0p2 (mmcblk0p2 is my ext4 formatted partition)
Code: [Select]
tce-setdrive ( select mmcblk0p2 )

Set password for tc
Code: [Select]
passwdInstall openssh
Code: [Select]
tce-load -wi openssh.tczRun the following commnads:
Code: [Select]
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
Start openssh
Code: [Select]
sudo /usr/local/etc/init.d/openssh start ( the application will now generate some keys, give it a couple of seconds )

That should be it. Now you can ssh to your Raspberry Pi from your computer ( login: tc and password: the one you've set )

Once logged in let's make this persistent ( so that openssh won't generate new keys on every boot )

I'm using MobaXterm so it's quite easy to edit files using the internal editor. No need for installing nano on the Raspberry Pi.
Open
/opt/.filetool.lst
Add
Code: [Select]
etc/passwd
etc/shadow
usr/local/etc/ssh/ssh_config
usr/local/etc/ssh/sshd_config
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
Save and exit.

Let's make openssh start on boot
Open
Code: [Select]
/opt/bootlocal.shAdd
Code: [Select]
/usr/local/etc/init.d/openssh startSave and exit.

The most important step, we have to backup the lot.
Run the following command:
Code: [Select]
filetool.sh -b
Reboot.


Offline Gerrelt

  • Full Member
  • ***
  • Posts: 176
I saved your instructions as an how-to install openssh!

Thank you gtr2! :)
my Raspberry Pi page: http://raspberry.gerrelt.nl

Offline gtr2

  • WikiUser
  • *
  • Posts: 19
@ Gerrelt
You're very welcome :)

Offline Gerrelt

  • Full Member
  • ***
  • Posts: 176

I just used your instructions to install ssh and it worked flawlessly!
It is so nice to be able to ftp to the TinyCore Raspberry. :D :)
It also feels faster, but that might be my imagination.

Thanks again!
my Raspberry Pi page: http://raspberry.gerrelt.nl