How to change sshd port on snow leopard?
What is the good way to tell the ssh server to listen to port 22 and 443?
iMac 24'', Mac OS X (10.6)
iMac 24'', Mac OS X (10.6)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.sshd</string>
<key>Program</key>
string>/usr/libexec/sshd-keygen-wrapper</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/sshd</string>
<string>-i</string>
</array>
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
<key>SessionCreate</key>
<true/>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>https</string>
</dict>
</dict>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
</dict>
</plist>
ssh 22/udp # SSH Remote Login Protocol
ssh 22/tcp # SSH Remote Login Protocol
What I do on Leopard is to edit /etc/services. Instead of "22" in these lines, I put in my new port number:
Camelot wrote:
Changing /etc/services will ... get overwritten at the next system update where Apple push out a new /etc/services file.
However, what the OP wants is to run ssh on both 22 and 443 simultaneously.
$ launchctl unload /System/Library/LaunchDaemon/ssh-443.plist
$ launchctl load /System/Library/LaunchDaemon/ssh-443.plist
But the result is simply:
nothing found to load
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" " http://www.apple.com/DTDs/PropertyList-1.0.dtd ">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>local.sshd</string>
<key>Program</key>
<string>/usr/libexec/sshd-keygen-wrapper</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/sshd</string>
<string>-i</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>https</string>
</dict>
</dict>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
</dict>
</plist>
If you have control over the ssh server config on the remote side, there’s an > even easier way – just make sshd listen on port 443 as well as 22. You can do > this by editing sshd_config (usually located in /etc/ssh/) and below this line:
Port 22
add a line like
Port 443
save, restart sshd, and you can then connect directly over port 443 using
ssh -p 443 user@host
How to change sshd port on snow leopard?