Jak na esxi změnit ssh port 22 na něco jiného
Napsal: pon 29. led 2018 11:11:03
Postupně dopřeložim. (Možná)
1. přihlašte se přes s ssh
cd /vmfs/volumes/datastore1
look like this > /sbin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e
[root@localhost:/vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e] pwd
/vmfs/volumes/datastore1
[root@localhost:/vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e] cat /etc/vmware/firewall/service.xml > ./service.xml
[root@localhost:/vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e] cat /etc/services > ./services
2. Edit following lines in this file.
# vi /etc/vmware/firewall/service.xml
under <id>sshServer</id>
<port>600</port>
End of file above </ConfigRoot>
<service id='0099'>
<id>TCPALLOUT</id>
<rule>
<direction>outbound</direction>
<protocol>tcp</protocol>
<protocol>dst</protocol>
<port>
<begin>1</begin>
<end>60000</end>
</port>
</rule>
<enabled>true</enabled>
<required>false</required>
</service>
:wq
3. Edit following lines in this file.
#vi /etc/services
ssh 600/tcp # SSH Remote Login Protocol
ssh 600/udp # SSH Remote Login Protocol
:wq
4. To verify the manually execute the following in order.
/bin/chmod 644 /etc/vmware/firewall/service.xml
/bin/chmod +t /etc/vmware/firewall/service.xml
/bin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e/service.xml /etc/vmware/firewall/service.xml
/bin/chmod 644 /etc/services
/bin/chmod +t /etc/services
/bin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e/services /etc/services
/bin/chmod 444 /etc/vmware/firewall/service.xml
/bin/chmod 444 /etc/services
/bin/esxcli network firewall refresh
4. After reboot above changes will not reflect. So we need to do below changes for permanent.
# vi /etc/rc.local.d/local.sh
/bin/chmod 644 /etc/vmware/firewall/service.xml
/bin/chmod +t /etc/vmware/firewall/service.xml
/bin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e/service.xml /etc/vmware/firewall/service.xml
/bin/chmod 644 /etc/services
/bin/chmod +t /etc/services
/bin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e/services /etc/services
/bin/chmod 444 /etc/vmware/firewall/service.xml
/bin/chmod 444 /etc/services
/bin/esxcli network firewall refresh
/bin/kill -HUP `cat /var/run/inetd.pid`
1. přihlašte se přes s ssh
cd /vmfs/volumes/datastore1
look like this > /sbin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e
[root@localhost:/vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e] pwd
/vmfs/volumes/datastore1
[root@localhost:/vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e] cat /etc/vmware/firewall/service.xml > ./service.xml
[root@localhost:/vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e] cat /etc/services > ./services
2. Edit following lines in this file.
# vi /etc/vmware/firewall/service.xml
under <id>sshServer</id>
<port>600</port>
End of file above </ConfigRoot>
<service id='0099'>
<id>TCPALLOUT</id>
<rule>
<direction>outbound</direction>
<protocol>tcp</protocol>
<protocol>dst</protocol>
<port>
<begin>1</begin>
<end>60000</end>
</port>
</rule>
<enabled>true</enabled>
<required>false</required>
</service>
:wq
3. Edit following lines in this file.
#vi /etc/services
ssh 600/tcp # SSH Remote Login Protocol
ssh 600/udp # SSH Remote Login Protocol
:wq
4. To verify the manually execute the following in order.
/bin/chmod 644 /etc/vmware/firewall/service.xml
/bin/chmod +t /etc/vmware/firewall/service.xml
/bin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e/service.xml /etc/vmware/firewall/service.xml
/bin/chmod 644 /etc/services
/bin/chmod +t /etc/services
/bin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e/services /etc/services
/bin/chmod 444 /etc/vmware/firewall/service.xml
/bin/chmod 444 /etc/services
/bin/esxcli network firewall refresh
4. After reboot above changes will not reflect. So we need to do below changes for permanent.
# vi /etc/rc.local.d/local.sh
/bin/chmod 644 /etc/vmware/firewall/service.xml
/bin/chmod +t /etc/vmware/firewall/service.xml
/bin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e/service.xml /etc/vmware/firewall/service.xml
/bin/chmod 644 /etc/services
/bin/chmod +t /etc/services
/bin/cp /vmfs/volumes/58db5900-c649bd50-8479-d4ae52d01b4e/services /etc/services
/bin/chmod 444 /etc/vmware/firewall/service.xml
/bin/chmod 444 /etc/services
/bin/esxcli network firewall refresh
/bin/kill -HUP `cat /var/run/inetd.pid`