On Mac, how to start/enable the sshd service?
I use network general tool to scan the ports, do not find the 22 port.
Seems Apple disables it by default.
I tried to open the sshd service:
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.
But failed.
How to open sshd service on Mac?
EDIT
I also tried use ssh-keygen to generate secretkey, but still not work.
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
Best Answer
Turn on Remote Login under System Preferences >> Sharing
It will enable the
sshd
service and allow you to connect.