MAC电脑修改ssh端口

简单的把过程写一下:

1.备份ssh.plist:

cp /System/Library/LaunchDaemons/ssh.plist /Library/LaunchDaemons/ssh2.plist

chmod o+w /Library/LaunchDaemons/ssh2.plist

vim /Library/LaunchDaemons/ssh2.plist

sudo chown -R root /Library/LaunchDaemons/ssh2.plist

sudo launchctl load -w /Library/LaunchDaemons/ssh2.plist

netstat -at | grep LISTEN

2.编辑/System/Library/LaunchDaemons/ssh.plist 文件,我们看到里面有Sockets这个key:

 <key>Sockets</key>
        <dict>
                <key>Listeners</key>
                <dict>
                        <key>SockServiceName</key>
                        <string>ssh</string>
                        <key>Bonjour</key>
                        <array>
                                <string>ssh</string>
                                <string>sftp-ssh</string>
                        </array>
                </dict>
        </dict>

将其中的SockServiceName对应的string:ssh修改为想要的端口即可

posted @ 2018-05-08 17:34  qinqinyang  阅读(1376)  评论(0编辑  收藏  举报