Can’t find sshd process

ssh

Using PuTTY on my Windows laptop, I am able to ssh into my Mac desktop, but once I've logged in, I can't find any sshd process running on the Mac. E.g. running the following right after ssh-ing into the Mac:

% ps -eo pid,command | grep sshd | grep -v grep

…produces no output. Of course, needless to say, I get the same results (no output) if I use ps -ef instead of ps -eo pid,command.

Also, there's no /var/run/sshd.pid file.

What's going on? Does OS X use a different program to handle incoming ssh logins?

Best Answer

No - OS X uses OpenSSH and you can inspect the source code used here.

Based on your output, it looks like sshd is not active on the machine. Also ps|grep ssh[d] will prevent your grep process from matching the target. Some people get concerned when they don't see sshd running, since it gets started on demand when launchd detects an incoming network request. Are you certain ssh is active? You could verify this with lsof|grep ssh if you have doubts.

Look for this when one ssh has been initiated recently on Lion:

Last login: Mon Jul 16 17:58:26 2012 from 10.0.1.35
mac:~ mike$ ps -ef|grep sshd
0   60320     1   0  4:23PM ??         0:00.00 /usr/libexec/launchproxy /usr/sbin/sshd -i
0   60321 60320   0  4:23PM ??         0:00.15 /usr/sbin/sshd -i
501 60330 60321   0  4:23PM ??         0:00.01 /usr/sbin/sshd -i
501 60336 60331   0  4:23PM ttys003    0:00.00 grep sshd