Replacing OpenSSH with Dropbear

When you are using a low-end server with only 64MB of memory, sometimes you just have to look for alternate software packages with less bloat to leave more memory for your (often more bloated) applications. OpenSSH is the essential application on a Linux/xBSD server, however I think it is eating up one or two more megabytes of memory than it should, and it can be easily replaced by a lighter weight SSH server like Dropbear.

On a Ubuntu 7.10 x86 server running OpenSSH:

$ ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      2052  0.0  0.2   5288   996 ?        Ss   Mar25   0:00 /usr/sbin/sshd
root     21819  0.2  0.7   8168  2700 ?        Ss   10:28   0:00 sshd: user@pts/0
user     21836  0.0  0.4   8044  1748 ?        S    10:29   0:00 sshd: user@pts/0
...

On a Debian 4 x86 server running Dropbear:

$ ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      1344  0.0  1.3   2648   864 ?        Ss   10:28   0:00 /usr/sbin/xinetd
root      1347  0.2  1.8   4216  1220 ?        Ss   10:29   0:00 dropbear -i -g
...

As you can see it is quite a bit of saving, especially if you operates a shell service where lots of people logging in (or use sftp/scp) at the same time. Also note that:

  • While Dropbear can be used as a standalone server, I am using it with xinetd so it uses even less memory (I am also running xinetd for a few other services).
  • If you log in as a non-root user, OpenSSH spawns two processes but Dropbear spawns only one.

Dropbear does have a few issues (terrible performance with SftpDrive, fewer features and options, etc), but it feels as good as OpenSSH for server administration but uses half amount of memory.

Comments 3

  1. weakish wrote:

    Cool article.

    Though I still prefer OpenSSH. OpenSSH is default on most systems. And thought I can live without sftp or sshfs, sometimes I do feel it’s convient if sshfs is available. I also heard that OpenSSH has better support for agent forwarding.

    But anyway, thanks for your article. Sometimes you just don’t have choice. Limited resources answer the question for you.

    Posted 14 Apr 2008 at 9:48 am
  2. LowEndAdmin wrote:

    @weakish — with OpenSSH installed, you can also get sftp and sshfs on Dropbear. Just that from my experience it is significantly slower than OpenSSH over a local area network. However if it is over the Internet then the bottleneck could have been the end-to-end bandwidth instead of Dropbear.

    OpenSSH has much richer feature set though. For example tun support so you can build a cheap VPN.

    Posted 14 Apr 2008 at 10:35 am
  3. weakish wrote:

    Thanks again for your detailed information.

    Posted 14 Apr 2008 at 3:42 pm

Post a Comment

Your email is never published nor shared. Required fields are marked *