The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
Changing the port used by SSH on an ESXi 5.0 host (2011818)
To modify the port used for SSH:
- Open the required firewall ports. For more information, see User defined xml firewall configurations are not persistent across ESXi host reboots (2007381).
This example shows a rule set .xml file to open TCP, port 2222:
<rule id = '0000'>
- Copy /etc/services to permanent storage (it can be on the same location as the firewall rules are stored, such as /vmfs/volumes/datastore1/hostname_etc/).
- Edit the copy of services on permanent storage and change the port for SSH.
ssh 2222/tcp # SSH Remote Login Protocol
ssh 2222/udp # SSH Remote Login Protocol
- Edit /etc/rc.local so the created files are copied back to host at boot time. Add lines to the end of the file, for example:
#Copy the new firewall rule from vmfs place holder to file system
cp /vmfs/volumes/datastore1/etc/ssh_2222.xml /etc/vmware/firewall/
#refresh firewall rules
esxcli network firewall refresh
#Copy the modified services file from vmfs place holder to file system
cp /vmfs/volumes/datastore1/etc/services /etc/services
#Restart inetd to get the changes
kill -HUP `cat /var/run/inetd.pid`
- Reboot the host, and attempt to connect to the host on the chosen port to verify that the changes were successful.
Request a Product Feature
To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.