Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

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
share|improve this answer
    
Downvoted for not showing also the output you get from ps -eo pid,command|grep sshd. It will show at least as many processes as those shown by ps -ef|grep sshd, proving that my failure to observe a sshd process is not explained by my choice of flags to ps. –  kjo Jul 18 '12 at 12:59
2  
Seriously - you down vote over a ps argument choice? The PID is clearly the second column and the command is the last column in the -ef but it's your vote to cast. Your criticism of everyone that stepped up to try to help seems an odd way to attract more help. –  bmike Jul 18 '12 at 14:00
    
My comment, and downvote, was in response to your original post, which started: "It looks like your syntax is a bit off." Which syntax in particular is off, and how exactly does this "off syntax" cause my not being able to see an sshd process? Later you write: "Also ps|grep ssh[d] will prevent your grep process from matching the target." I don't see why this is relevant, since, I did not use ps|grep sshd, nor did I use ps|grep ssh. Finally,... –  kjo Jul 18 '12 at 19:26
    
...you wrote: "Some people get concerned when they don't see sshd running, since it gets started on demand when launchd detects an incoming network request." Given that I clearly wrote that I searched for the sshd process immediately after ssh-ing into the Mac, your last remark, as well as the questions you ask in the revised version of your answer, make me question whether you actually read my post. –  kjo Jul 18 '12 at 19:26
add comment

let me clarify:

sshd by default is no longer an active process on boot after 10.3. launchd now handles the listening for ssh. sshd only is running when an ssh session is active.

share|improve this answer
    
As I wrote in my original description, I am looking for the sshd process from within an ssh session, so, if your explanation were correct, I should have been able to find the sshd process behind it. –  kjo Jul 18 '12 at 13:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.