Overview
This article explains the process to change the SSH (Secure Shell) Port in Mac OS X.
Process
By default, Mac OS X uses port 22 for SSH. Follow these steps to change it:
- Open Terminal on the Mac.
- Run the following command:
read -p "Please enter new SSH Port number: " sshport; sudo sed -i "-bak" -n "/SockServiceName/{p;n;s/>.*</>$sshport</;};p" /System/Library/LaunchDaemons/ssh.plist; echo "SSH Port $sshport. Restart service for changes to take effect."
- Enter the new port number.
- Enter your password.
- Restart the SSH service by either restarting the computer or running the following commands in Terminal:
-
ps aux | grep sshd - find the PID for SSH
-
kill -1 <PID>
-
Priyanka Bhotika
Comments