why are there so many instances of sshd running on my server?

8146 root      15   0 69432 3224 2500 S  1.3  1.2   0:00.04 sshd                                                                                                                    
    1 root      15   0 23560 1696 1356 S  0.0  0.6   0:01.25 init                                                                                                                    
 1167 root      18   0 14764 1132  932 S  0.0  0.4   0:00.01 xinetd                                                                                                                  
 1168 daemon    18   0 16692  452  292 S  0.0  0.2   0:00.00 atd                                                                                                                     
 1169 root      15   0 18892 1056  820 S  0.0  0.4   0:00.51 cron                                                                                                                    
 1197 root      15   0 49428 2696 2132 S  0.0  1.0   0:06.34 sshd                                                                                                                    
 1215 syslog    15   0 12540  792  616 S  0.0  0.3   0:02.37 syslogd                                                                                                                 
 1284 root      18   0 68268 2468  792 S  0.0  0.9   0:01.32 sendmail-mta                                                                                                            
 1980 root      16   0 70768 3328 2584 S  0.0  1.3   0:00.03 sshd                                                                                                                    
 1994 sysadmin  15   0 70768 1648  896 S  0.0  0.6   0:00.08 sshd                                                                                                                    
 1997 sysadmin  16   0 18092 2148 1540 S  0.0  0.8   0:00.03 bash                                                                                                                    
 8020 root      16   0 70768 3328 2584 S  0.0  1.3   0:00.04 sshd                                                                                                                    
 8036 sysadmin  15   0 70768 1660  896 R  0.0  0.6   0:00.01 sshd                                                                                                                    
 8037 sysadmin  15   0 18092 2124 1520 S  0.0  0.8   0:00.01 bash                                                                                                                    
 8065 sysadmin  15   0 19184 1312 1060 R  0.0  0.5   0:00.06 top                                                                                                                     

I am on an openvz virtual host, so the memory usage reported here by top is form the whole machine. The sshds are consuming most of my available memory - why are there so many? Do I need them all?


The OpenSSH server will fork a copy for every client connected. So if you look at the output of netstat -nt | grep :22 you should see several connections, plus you will see additional processes per user if you have privilege separation enabled (UsePrivilegeSeparation).

Given your output, I would guess you have two connections open as the user sysadmin, and you have privilege separation enabled.