WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] How to make ssh server configuration permanent?  (Read 14498 times)

Offline Adam

  • Full Member
  • ***
  • Posts: 121
[SOLVED] How to make ssh server configuration permanent?
« on: August 01, 2013, 06:08:30 PM »
April last year, I had experience to configure ssh server (sshd) in Tiny Core Linux and had documented it here.

http://firewallengineer.wordpress.com/2012/04/01/how-to-install-and-configure-openssh-ssh-server-in-tiny-core-linux/

All these were running on live cd.

When I installed TC in hard disk (VDI), I’ve noticed that /usr/local/etc/ssh/sshd_config will be gone every time I reboot my VB guest. Is there any way to make it permanent?

http://firewallengineer.wordpress.com/2013/08/02/how-to-make-ssh-server-configuration-permanent/
« Last Edit: August 12, 2013, 06:41:56 AM by Adam »

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: How to make ssh server configuration permanent?
« Reply #1 on: August 01, 2013, 06:33:50 PM »
Add it to /opt/.filetool.lst and do a backup.

Offline Adam

  • Full Member
  • ***
  • Posts: 121
Re: How to make ssh server configuration permanent?
« Reply #2 on: August 01, 2013, 06:49:27 PM »
Add it to /opt/.filetool.lst and do a backup.

Can you share example of /opt/.filetool.lst

This is what I have in my TC
Quote
root@box:~# cat /opt/.filetool.lst
opt
home
root@box:~#

Quick ssh server configuration
Quote
cd /usr/local/etc/ssh/
cp sshd_config.example sshd_config
/usr/local/etc/init.d/openssh start

Change tc password
passwd tc

To verify
ps | grep ssh
telnet tc@localhost

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: How to make ssh server configuration permanent?
« Reply #3 on: August 01, 2013, 08:44:02 PM »
Hi Adam
Add the following to  /opt/.filetool.lst
Code: [Select]
usr/local/etc/ssh/sshd_config

Offline Adam

  • Full Member
  • ***
  • Posts: 121
Re: How to make ssh server configuration permanent?
« Reply #4 on: August 12, 2013, 03:00:53 AM »
Thanks. This is my current config. Good things is file “usr/local/etc/ssh/sshd_config” is remain, but ssh service does not restart automatically.

Hence, I’ve to restart it manually after reboot. Is it possible to make this permanent?

RESTART SSH SERVER MANUALLY
Code: [Select]
root@box:~# /usr/local/etc/init.d/openssh start
root@box:~# passwd tc
Changing password for tc
New password:

VERIFY SSH SERVICE
Code: [Select]
root@box:~# ps | grep ssh
  814 root     /usr/local/sbin/sshd
  820 root     sshd: tc [priv]
  828 tc       {sshd} sshd: tc@pts/0
  890 root     grep ssh
root@box:~#

Code: [Select]
root@box:~# ls -l /usr/local/etc/ssh/
total 28
lrwxrwxrwx    1 root     root            44 Aug 12 07:02 moduli -> /tmp/tcloop/openssh/usr/local/etc/ssh/moduli
lrwxrwxrwx    1 root     root            56 Aug 12 07:02 ssh_config.example -> /tmp/tcloop/openssh/usr/local/etc/ssh/ssh_config.example
-rw-------    1 root     root           668 Aug 12 07:07 ssh_host_dsa_key
-rw-r--r--    1 root     root           598 Aug 12 07:07 ssh_host_dsa_key.pub
-rw-------    1 root     root           227 Aug 12 07:07 ssh_host_ecdsa_key
-rw-r--r--    1 root     root           170 Aug 12 07:07 ssh_host_ecdsa_key.pub
-rw-------    1 root     root          1679 Aug 12 07:07 ssh_host_rsa_key
-rw-r--r--    1 root     root           390 Aug 12 07:07 ssh_host_rsa_key.pub
-rw-r--r--    1 root     root          3715 Aug  1 02:44 sshd_config
lrwxrwxrwx    1 root     root            57 Aug 12 07:02 sshd_config.example -> /tmp/tcloop/openssh/usr/local/etc/ssh/sshd_config.example
root@box:~#

CURRENT CONFIG
Code: [Select]
root@box:~# ls -l /opt/.filetool.lst
-rw-rw-r--    1 root     staff           39 Aug 12 05:57 /opt/.filetool.lst
root@box:~#

root@box:~# cat /opt/.filetool.lst
opt
home
usr/local/etc/ssh/sshd_config
root@box:~#

BACKUP
Code: [Select]
root@box:~# filetool.sh -b
Backing up files to /mnt/sda1/tce/mydata.tgzDone.
root@box:~#

AFTER REBOOT
Code: [Select]
root@box:~# ps | grep ssh
  798 root     grep ssh
root@box:~#

Code: [Select]
root@box:/# ls -l /usr/local/etc/ssh/
total 28
lrwxrwxrwx    1 root     root            44 Aug 12 06:55 moduli -> /tmp/tcloop/openssh/usr/local/etc/ssh/moduli
lrwxrwxrwx    1 root     root            56 Aug 12 06:55 ssh_config.example -> /tmp/tcloop/openssh/usr/local/etc/ssh/ssh_config.example
-rw-r--r--    1 root     root          3715 Aug  1 02:44 sshd_config
lrwxrwxrwx    1 root     root            57 Aug 12 06:55 sshd_config.example -> /tmp/tcloop/openssh/usr/local/etc/ssh/sshd_config.example
root@box:/#
« Last Edit: August 12, 2013, 03:10:04 AM by Adam »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: How to make ssh server configuration permanent?
« Reply #5 on: August 12, 2013, 05:36:54 AM »
You need to start it from /opt/bootlocal.sh for example. Also, you forgot to backup the passwd file.
The only barriers that can stop you are the ones you create yourself.

Offline Adam

  • Full Member
  • ***
  • Posts: 121
Re: How to make ssh server configuration permanent?
« Reply #6 on: August 12, 2013, 06:40:43 AM »
You need to start it from /opt/bootlocal.sh for example. Also, you forgot to backup the passwd file.

Done. Works like a charm. Thanks a lot curaga. Now I understand how Core Linux works a little bit especially on the persistent part.

http://wiki.tinycorelinux.net/wiki:start#persistence
http://distro.ibiblio.org/tinycorelinux/concepts.html

EDIT START UP FILE
Code: [Select]
tc@box:/$ echo '/usr/local/etc/init.d/openssh start &' >> /opt/bootlocal.sh
tc@box:/$

VERIFY
Code: [Select]
tc@box:/$ cat /opt/bootlocal.sh
#!/bin/sh
# put other system startup commands here
/opt/eth0.sh &
/usr/local/etc/init.d/openssh start &
tc@box:/$

BACKUP
Code: [Select]
tc@box:/$ filetool.sh -b
Backing up files to /mnt/sda1/tce/mydata.tgzDone.
tc@box:/$