Home » How to replace SSH with Dropbear

How to replace SSH with Dropbear

This tutorial will show you how to install the dropbear SSH server on Ubuntu 16.04. This steps should, however, also work on newer versions of Ubuntu, and modern versions of Debian.

Why?

Here are a few reasons you might want to use dropbear instead of the OpenSSH server:

  • RAM- Dropbear uses less resources than SSH, which is especially important when on < 1GiB of RAM
  • Compatible- Dropbear is fully compatible with SSH clients, and will even set variables such as $SSH_CONNECTION. It will even work with authorized-keys files

Why not?

Here is the only reason you might not want to switch to Dropbear:

  • PAM- Dropbear will NOT support PAM modules such as two-factor authentication

Installation

To install on Ubuntu 16.04, simply run the following two commands on your VPS:

sudo apt update
sudo apt install dropbear

Configuration

To enable dropbear, edit the config file with:

sudo nano /etc/default/dropbear

and change:

NO_START=1

to

NO_START=0

and make sure the following is set:

DROPBEAR_PORT=22

22 is the default for SSH, but you can change it if you use another port for SSH(such as 443 to get around firewalls).

Disable SSH

You could just delete the OpenSSH server with

sudo apt purge openssh-server

but, in case you mess up, you can just stop and disable SSH from auto-starting on boot with:

sudo systemctl disable ssh
sudo service ssh stop

Test Dropbear

Now, in a NEW terminal window(in case you messed up;the current session will continue and allow you to troubleshoot without using the console) use:

ssh [email protected]

and everything should be the exact same as when you used OpenSSH. Be sure to check that your authorized_keys file works.

Re-enable SSH

In case you break something, and want to revert to SSH, just run the following commands:

sudo systemctl enable ssh
sudo systemctl disable dropbear
sudo service dropbear stop
sudo service ssh restart

and SSH should be restored, assuming you didn’t delete OpenSSH, in which case you need to re-install it:

sudo apt install openssh-server

Leave a Reply(Markdown is On)