Autostart ssh Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
CGA
Posts: 9
Joined: Wed Jul 08, 2020 8:37 am

Autostart ssh

Post by CGA »

Any idea how to get ssh to start automatically at boot? Most of the solutions I've found suggests running "systemctl start ssh" but that doesn't seem to do it, dietpi-services after boot always says ssh inactive.
User avatar
Joulinar
Posts: 2034
Joined: Sat Nov 16, 2019 12:49 am

Re: Autostart ssh

Post by Joulinar »

Hi,

many thanks for your report. By default ssh is enabled on reboot and usually nothing needs to be done or started manually. The default SSH server inside DietPi is Dropbear.

Code: Select all

root@DietPi4:~# systemctl status dropbear.service
● dropbear.service - LSB: Lightweight SSH server
   Loaded: loaded (/etc/init.d/dropbear; generated)
   Active: active (running) since Tue 2020-07-07 23:45:14 CEST; 2 days ago
     Docs: man:systemd-sysv-generator(8)
  Process: 637 ExecStart=/etc/init.d/dropbear start (code=exited, status=0/SUCCESS)
    Tasks: 5 (limit: 4915)
   Memory: 160.2M
   CGroup: /system.slice/dropbear.service
           ├─  646 /usr/sbin/dropbear -p 22 -W 65536
           ├─31885 /usr/sbin/dropbear -p 22 -W 65536
           ├─31887 -bash
           ├─31956 systemctl status dropbear.service
           └─31957 pager
Did you changes SSH Server to something else?

Something not functioning correctly on your system if SSH is not working after reboot
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
CGA
Posts: 9
Joined: Wed Jul 08, 2020 8:37 am

Re: Autostart ssh

Post by CGA »

Thanks for your reply! Guess I've been a bit too tinker-happy :). Didn't realize ssh was built in, so I installed openssh. I assume removing openssh and reinstalling Dropbear will fix it.

Edit: Just realized why I went with openssh, sftp support.
trendy
Posts: 118
Joined: Tue Feb 25, 2020 2:54 pm

Re: Autostart ssh

Post by trendy »

You can have openssh-sftp with dropbear. You don't need openssh-server necessarily.
arpeggio
Posts: 4
Joined: Sat Jul 11, 2020 7:02 pm

Re: Autostart ssh

Post by arpeggio »

CGA wrote: Sat Jul 11, 2020 9:44 am Edit: Just realized why I went with openssh, sftp support.
Dropbear definitely supports sftp... and it's pretty easy to add the functionality (less than 30 secs). :)

#Enable SCP Function with Standard DropBear SSH Server
apt install openssh-client
apt install openssh-sftp-server


taken from: https://github.com/MichaIng/DietPi/issues/3296
This installs the /usr/lib/sftp-server invoked by Dropbear on SFTP client access.

Only take care to not install the openssh-server package, which enables the conflicting
OpenSSH server service (sshd), which blocks port 22 by default, used by Dropbear already for
initial SSH access.
Hope this helps!
CGA
Posts: 9
Joined: Wed Jul 08, 2020 8:37 am

Re: Autostart ssh

Post by CGA »

Big thanks!
User avatar
Joulinar
Posts: 2034
Joined: Sat Nov 16, 2019 12:49 am

Re: Autostart ssh

Post by Joulinar »

in general it should be fine if you install OpenSSH Client (ID 0) from dietpi-software. This will allow SCP at least.

BTW: DietPi is designed to work completely headless. Yes, therefore SSH is available right from the beginning ;)

And if you need OpenSSH, just go to dietpi-software and change SSH Server preference to OpenSSH. This will automatically install OpenSSH and remove Dropbear.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
CGA
Posts: 9
Joined: Wed Jul 08, 2020 8:37 am

Re: Autostart ssh

Post by CGA »

What is Dropbear's equivalent of sshd_config? I would like to add the same configuration I had in openssh.
CGA
Posts: 9
Joined: Wed Jul 08, 2020 8:37 am

Re: Autostart ssh

Post by CGA »

What is Dropbear's equivalent of sshd_config? I would like to add the same "Match group" configuration I had in openssh.
User avatar
Joulinar
Posts: 2034
Joined: Sat Nov 16, 2019 12:49 am

Re: Autostart ssh

Post by Joulinar »

Dropbear config file can be found at /etc/default/dropbear . But it's not that feature rich like OpenSSH

Some options that can be set https://wiki.raptorcs.com/wiki/BMC_Configure_dropbear
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply