sshd不会“重新读取”它的配置文件,它会自行重新启动(请参考man sshd(8)),但是,如果您将SIGHUP发送给所有子进程/父进程,则它不应杀死子进程/连接。那就是当您在谈论绑定到端口22的sshd时,如在Linux / FreeBSD / etc的“常规”中一样。[存在例外和sysadmin原因,为什么要遵循MacOSX类型的路由]
但是, MacOSX已作为侦听并处理端口22(从我的10.10.4计算机上)的端口启动:
BlackYos:~ hvisage$ sudo lsof -i :22
Password:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
launchd 1 root 57u IPv4 0xdb59a664e4b34941 0t0 TCP blackyos:ssh->hvs:39093 (ESTABLISHED)
launchd 1 root 58u IPv4 0xdb59a664e4b34941 0t0 TCP blackyos:ssh->hvs:39093 (ESTABLISHED)
launchd 1 root 62u IPv6 0xdb59a664c78cd671 0t0 TCP *:ssh (LISTEN)
launchd 1 root 66u IPv4 0xdb59a664c78d2e21 0t0 TCP *:ssh (LISTEN)
launchd 1 root 67u IPv6 0xdb59a664c78cd671 0t0 TCP *:ssh (LISTEN)
launchd 1 root 68u IPv4 0xdb59a664c78d2e21 0t0 TCP *:ssh (LISTEN)
ssh 1262 hvisage 3u IPv4 0xdb59a664e59313b1 0t0 TCP blackyos:51628->hvs:ssh (ESTABLISHED)
sshd 1272 root 4u IPv4 0xdb59a664e4b34941 0t0 TCP blackyos:ssh->hvs:39093 (ESTABLISHED)
sshd 1272 root 5u IPv4 0xdb59a664e4b34941 0t0 TCP blackyos:ssh->hvs:39093 (ESTABLISHED)
sshd 1274 hvisage 4u IPv4 0xdb59a664e4b34941 0t0 TCP blackyos:ssh->hvs:39093 (ESTABLISHED)
sshd 1274 hvisage 5u IPv4 0xdb59a664e4b34941 0t0 TCP blackyos:ssh->hvs:39093 (ESTABLISHED)
它启动后可能需要在macosx上“重新启动”,或者被告知要监听sshd的其他端口,因为启动后将为进入的每个端口22生成一个新的sshd。
检查以下内容:
BlackYos:~ hvisage$ sudo ps -ef |grep -i ssh
501 1263 1 0 6:46PM ?? 0:00.06 /usr/bin/ssh-agent -l
0 1272 1 0 6:46PM ?? 0:00.40 sshd: hvisage [priv]
501 1274 1272 0 6:46PM ?? 0:00.03 sshd: hvisage@ttys004
501 1262 570 0 6:46PM ttys001 0:00.05 ssh -v hvs
501 1303 1275 0 6:50PM ttys004 0:00.00 grep -i ssh
BlackYos:~ hvisage$
我已经回切到路由器并演示了该问题,您会注意到这两个进程已由我“拥有”。将此与Linux系统(我的选择者)进行比较,您会在其中注意到root拥有的第三个“真实” sshd:
hvisage@hvs:~$ ps -ef |grep -i ssh
root 4053 1 0 Jul11 ? 00:04:22 /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/auth.log -w /etc/sshguard/whitelist -a 40 -p 420 -s 1200
root 16244 30219 0 18:46 ? 00:00:00 sshd: hvisage [priv]
hvisage 16249 16244 0 18:46 ? 00:00:00 sshd: hvisage@pts/0
hvisage 16563 16250 0 18:52 pts/0 00:00:00 grep -i ssh
root 30219 1 0 Aug09 ? 00:00:00 /usr/sbin/sshd
hvisage@hvs:~$
kill -HUP <PID of sshd>
?根据man sshd
:sshd rereads its configuration file when it receives a hangup signal, SIGHUP
。(您可以找到sshd
with 的PIDps -ef|grep sshd
。如果有多个sshd
进程,HUP
则将其发送给所有进程。)