22

How to restart SSH in Mac Pro?

When I used: sudo service ssh restart its shows:

Command not found

sudo service ssh restart, Command not found

2
  • 1
    This is a System V command that macOS does not have. What do you want to achieve, really? Are you experiencing any issues with SSH logins?
    – slhck
    Oct 1, 2019 at 12:16
  • 1
    Furthermore, macOS manages sshd differently enough that there's no real equivalent to "restart"ing the service. More specifically, a new server process is started for each incoming connection on port 22; this means that if there's no active ssh connection, there's nothing running to restart (and if there is one, you probably don't want to kill it). So... yeah, what's the actual goal here? Oct 1, 2019 at 17:42

2 Answers 2

15

Try with:

sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist 
1
  • what about sudo /usr/sbin/sshd in case it doesn't work? Also sudo systemsetup -setremotelogin on in case it is not open. Jan 20, 2021 at 13:46
11

Go to System Preferences > Sharing, uncheck Remote Login, recheck Remote Login.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .