MAC电脑修改ssh端口
时间:2018-05-08 19:16:53
收藏:0
阅读:1327
简单的把过程写一下:
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修改为想要的端口即可
评论(0)