Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yoggy/ddd874cd567aff182426 to your computer and use it in GitHub Desktop.
Save yoggy/ddd874cd567aff182426 to your computer and use it in GitHub Desktop.

Mac OS Xでsshを別のポート番号でlistenさせる設定

注意

設定方法

追加でポート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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment