Autostart ssh

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.


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.

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

Thanks for your reply! Guess I’ve been a bit too tinker-happy :slight_smile:. 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.

You can have openssh-sftp with dropbear. You don’t need openssh-server necessarily.

Dropbear definitely supports sftp… and it’s pretty easy to add the functionality (less than 30 secs). :slight_smile:

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

taken from:

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!

Big thanks!

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 :wink:

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.

What is Dropbear’s equivalent of sshd_config? I would like to add the same configuration I had in openssh.

What is Dropbear’s equivalent of sshd_config? I would like to add the same “Match group” configuration I had in openssh.

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