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.