A number of things could of have happened. A few things come to mind:
- Your firewall is still blocking the connection.
- Another service is running on port 62
- You did not restart the service after changing the value
- ...
Try connecting via the out-of-band console (if you have one) and alter what needs to be changed (firewall, settings, ...). To test wether or not your firewall is bugging you, stop it for a little while and see if you can get in (service iptables stop)
I'm also not sure about putting 0062 as a port. You might need to put 62 instead.
If you are unable to get into the out-of-band, ask your provider to have a look. Otherwise, you will have to reimage the machine.
The script should indeed change both the port on the firewall and in the config for ssh:
sed -i 's/#HostKey \/etc\/ssh\/ssh_host_rsa_key/HostKey \/etc\/ssh\/ssh_host_rsa_key/g' /etc/ssh/sshd_config
sed -i 's/#HostKey \/etc\/ssh\/ssh_host_dsa_key/HostKey \/etc\/ssh\/ssh_host_dsa_key/g' /etc/ssh/sshd_config
sed -i 's/#PubkeyAuthentication/PubkeyAuthentication/g' /etc/ssh/sshd_config
sed -i 's/#RSAAuthentication/RSAAuthentication/g' /etc/ssh/sshd_config
sed -i 's/#AuthorizedKeysFile/AuthorizedKeysFile/g' /etc/ssh/sshd_config
sed -i 's/#IgnoreRhosts yes/IgnoreRhosts yes/g' /etc/ssh/sshd_config
sed -i 's/#PermitEmptyPasswords no/PermitEmptyPasswords no/g' /etc/ssh/sshd_config
/usr/sbin/sshd -t
service sshd restart
iptables -I INPUT -p tcp --dport $PORTNUM -j ACCEPT
service iptables restart
However, the 0062 might of have b0rked one or maybe both of them. Try getting back into your machine first.
nmapto look for opened port. Also on many languages having a number starting with 0 means it should be interpreted as octal, did you try then to connect to port 50 instead (62 in octal is 50 in decimal) – Huygens May 8 '12 at 12:38