注意
- El CapitanからSIP(System Intregrity Protection)が有効なので/System以下のファイルは直接触ることができない
- https://forums.developer.apple.com/thread/4731?q=SIP
追加でポート10022番でsshdをlistenさせる設定。
$ sudo cp /System/Library/LaunchDaemons/ssh.plist /Library/LaunchDaemons/ssh10022.plist
$ sudo vi /Library/LaunchDaemons/ssh10022.plist
$ diff -u /System/Library/LaunchDaemons/ssh.plist /Library/LaunchDaemons/ssh10022.plist
--- /System/Library/LaunchDaemons/ssh.plist 2015-08-23 08:30:17.000000000 +0900
+++ /Library/LaunchDaemons/ssh10022.plist 2015-10-03 12:00:55.000000000 +0900
@@ -5,7 +5,7 @@
<key>Disabled</key>
<true/>
<key>Label</key>
- <string>com.openssh.sshd</string>
+ <string>com.openssh.sshd10022</string>
<key>Program</key>
<string>/usr/libexec/sshd-keygen-wrapper</string>
<key>ProgramArguments</key>
@@ -18,7 +18,7 @@
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
- <string>ssh</string>
+ <string>10022</string>
<key>Bonjour</key>
<array>
<string>ssh</string>
$ sudo launchctl load -w /Library/LaunchDaemons/ssh10022.plist
unloadを使う
$ sudo launchctl unload /Library/LaunchDaemons/ssh10022.plist