starting ssh upon boot


Forum: DSL Embedded
Topic: starting ssh upon boot
started by: robertakit

Posted by Guest on June 12 2007,23:42
I use QEMU-on-a-stick.  What is the canonical/preferred way of getting ssh (sshd) to start upon boot?  I'd like to avoid having to do "sudo /etc/init.d/ssh start" or using the menu item to start it.

Thanks.

Posted by ^thehatsrule^ on June 13 2007,00:07
wiki: cheatcodes

note that you will not be able to log in (by default) unless you have passwords set

Posted by Guest on June 13 2007,00:29
Quote (^thehatsrule^ @ June 12 2007,20:07)
wiki: cheatcodes
Thanks.

For those following at home, the fix was to add ssh to the append section in the dsl-vhd.bat script.

Quote
note that you will not be able to log in (by default) unless you have passwords set
Yes.  Or, as I have it set-up, I use .ssh/authorized_keys and I don't need a password.

So, using the -redir flag ("-redir tcp:22222::22") for qemu, I am now able to log into my "stick".  This is great!

Posted by Guest on June 13 2007,22:53
I noticed that the ssh host key seems to change each time.

Is there any way to persist/retain the same ssh host key between boots?

Posted by ^thehatsrule^ on June 13 2007,23:00
Are you using backup/restore?
Posted by Guest on June 15 2007,22:10
Yes, I am using backup/restore.

But, I'm not currently backing up (via .filetool.lst) /etc/ssh/*key .  Should I?  I would've thought that would not work because the ssh service is started before the files are restored.  Or, am I confused?

Posted by roberts on June 16 2007,15:28
Does adding

/etc/init.d/ssh start

to /opt/bootlocal.sh

help.

This will run as root and occurs after the backup is restored.

Posted by Guest on June 19 2007,20:00
[I thought I replied to this, but I cannot find my response.]

I tried adding
Quote
etc/ssh/ssh_host_key
etc/ssh/ssh_host_key.pub
etc.
to .filetool.lst and then adding
Code Sample
/etc/init.d/ssh restart
to /opt/bootlocal.sh, but these changes did not help.

I guess I'll have to live with it.

Posted by roberts on June 19 2007,21:18
start <> restart

Why start it in the first place? When you can start it in bootlocal.sh

If you start it at boot and then want to re-read the configurations then look at

reload or perhaps force-reload

Look at the script options in /etc/init.d/ssh

Posted by Guest on June 19 2007,21:20
Quote (roberts @ June 19 2007,17:18)
start <> restart

Why start it in the first place? When you can start it in bootlocal.sh


Oh, I see.  You mean, I shouldn't use the cheatcode?

Posted by Guest on June 21 2007,20:47
Getting rid of the ssh cheat code and putting etc/ssh/*key* into .filetool.lst and doing
Code Sample
/etc/init.d/ssh start
in /opt/bootlocal.sh  seems to have fixed the problem.

Thanks, again!

Posted by jpeters on Sep. 23 2007,17:47
Quote (Guest @ June 21 2007,16:47)
Getting rid of the ssh cheat code and putting etc/ssh/*key* into .filetool.lst and doing
Code Sample
/etc/init.d/ssh start
in /opt/bootlocal.sh  seems to have fixed the problem.

Thanks, again!

Starting ssh would generate a new key, so I don't see why saving the key in /etc/ssh would help.  I found that /root/.ssh had to be deleted on the local computer so that the new key could be rewritten from the remote.
Posted by ^thehatsrule^ on Sep. 23 2007,21:56
If you save the key, then it won't generate a new one.
Posted by jpeters on Sep. 23 2007,22:24
..it did when I tried it.

Edit:  ...oh,  placing /etc/ssh/*key* in .filetool.lst doesn't save the files.

Edit2  What works is to copy the *key* files to another folder (e.g., ~HOME/ssh_keys) and then put a copy command into /opt/bootlocal prior to "ssh start"  (e.g., cp /home/dsl/ssh_keys/*key*  /etc/ssh/)

Thanks Hats...

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.