VMware vSphere

 View Only
Expand all | Collapse all

Change port SSH on ESXi 5

  • 1.  Change port SSH on ESXi 5

    Posted Oct 28, 2011 03:10 PM

    How can i can change the default port of ssh on vmware ESXi 5.0?

    I found that in the /etc/ssh/sshd_config the line that contains:

    Port 22

    I change the numbre with other, but i don't know how restart the services. How can reset SSHd?

    Thanks



  • 2.  RE: Change port SSH on ESXi 5

    Posted Oct 28, 2011 03:30 PM

    check the below, it should still be applicaiton for ESXi5

    http://vm-help.com/esx40i/ESXi_enable_SSH.php

    Changing the port for SSH

    To change the port for SSH, edit the file  /etc/services and change the SSH port listed in the file. Save the file  and repeat step 6 above


  • 3.  RE: Change port SSH on ESXi 5

    Posted Oct 28, 2011 03:53 PM

    I try this link to, but i haven't initd in my VMware ESXi 5. This is for ESXi 4.

    #ps | grep inetd

    #

    #ls -l /etc/inetd.conf

    ls: /etc/inetd.conf: No such file or directory



  • 4.  RE: Change port SSH on ESXi 5

    Posted Oct 28, 2011 03:54 PM

    restart the managment agents instead

    services.sh restart



  • 5.  RE: Change port SSH on ESXi 5

    Posted Oct 28, 2011 04:40 PM

    Troy Clavell wrote:

    restart the managment agents instead

    services.sh restart
    

    With this command i see that the port was changed, because i do ssh in localhost with other port that the default and connect perfect. But now the problem is in the firewall, ESXi 5 have iptables? How can i enable the port in the firewall?



  • 6.  RE: Change port SSH on ESXi 5

    Posted Oct 28, 2011 04:47 PM

    you should be able to do this using the vSphere Client... Under the Configuration Tab--Security Profile.  I don't have a ESXi5 Host handy today, or I could give you step by step.



  • 7.  RE: Change port SSH on ESXi 5
    Best Answer

    Posted Oct 28, 2011 06:05 PM

    Though not supported, you can try below method(Tested on ESXi5.0).

    1) Create new custom firewall ruleset let say sshnew.xml in any datastore eg: /vmfs/volumes/datastore1:

    <!-- Firewall configuration information for FDM -->
    <ConfigRoot>
    <service id='0000'>
    <id>sshnew</id>
    <rule id='0000'>
    <direction>inbound</direction>
    <protocol>tcp</protocol>
    <porttype>dst</porttype>
    <port>2200</port>
    </rule>
    <enabled>true</enabled>
    <required>false</required>
    </service>
    </ConfigRoot>

    2) Make the script persistent after reboot by editing /etc/rc.local and add below line:

    #Create custom SSHNEW rule
    cp /vmfs/volumes/datastore1/ssh.xml /etc/vmware/firewall

    #Refresh Firewall Rules
    /sbin/esxcli network firewall refresh

    Happy... SSH



  • 8.  RE: Change port SSH on ESXi 5

    Posted May 05, 2012 10:01 PM

    I did exactly as described, and I get "connection refused" when directing the vSphere client to 192.168.100.11:444 (my new port).  Likewise with Putty.

    Did I miss something?

    (running 623860)



  • 9.  RE: Change port SSH on ESXi 5

    Posted Oct 28, 2011 03:33 PM

    Host -> configuration -> security profile -> services -> SSH -> option -> restart



  • 10.  RE: Change port SSH on ESXi 5

    Posted Oct 28, 2011 03:43 PM

    Yes, i proved to restart from vSphere Client, but the port still is the default. Don't take the change.



  • 11.  RE: Change port SSH on ESXi 5

    Posted Apr 05, 2012 06:05 AM

    Not to bump an old thread, but google brought me here.

    Don't do "services.sh restart", this is overkill.

    /etc/init.d/SSH restart

    is all you need for the configuration change to take.

    ..and nice custom firewall rule.. :thumbsup: