如何打开sshd服务?


1

在Mac上,如何启动/启用sshd服务?

我使用网络通用工具扫描端口,找不到22端口。

enter image description here

似乎Apple默认禁用它。

我试图打开sshd服务:

aircraftdeMacBook-Pro:.ssh ldl$ sudo /usr/sbin/sshd
Password:
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.

但失败了。

如何在Mac上打开sshd服务?


编辑

我也尝试使用ssh-keygen生成密钥,但仍然无法正常工作。

ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
/usr/sbin/sshd

Answers:


3

在“系统偏好设置”下打开“远程登录”>>分享

它将启用 sshd 服务,并允许您连接。

enter image description here

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.