I have an Ubuntu 11.04 server in a remote location on another continent, so I have no physical access to it. I only interact with it by ssh (and scp), and intend to only ever interact with it that way.
For security purposes, I want to ensure that absolutely all ports on the server are closed, except for ssh.
My understanding is still vague, despite having tried to find instructions on the web. What I've gathered so far is that I need to "flush" the "iptables", and also that I need to edit some files (/etc/hosts, maybe?), and reboot the machine.
Obviously, though, I want to be very careful about this, because if I do it wrong, I could end up accidentally shutting down the ssh port, making the server inaccessible to me. If that happens, I have to go to the server administrator, who will reinstall the server, and make fun of me in the process.
I'm not a server admin guru by any stretch, so I'm looking to establish a fool proof set of steps before I do this.
So, how do I shut down all ports while still preserving my access?
Bonus question: While doing this, should I, and can I, change the ssh port from 22 to a non-standard one? Does it really make a difference?

atcommand to run commands once at a specified time, so, for example, you could reinstante your original configuration files (and reload config) two hours later, so even if you lock yourself out by misconfiguration, the system will revert to the previous state. If it does work, useatrmto cancel theatcommand. – Ulrich Schwarz Apr 27 '12 at 6:09iptablesfrontend. I useferm. It requires perl but the configuration is intuitive, and it is installed as a "service" whose start and stop scripts handle the loading and unloading ofiptablesrules. Your bonus question about ssh ports is a bit off-topic. Check yourauthlogs. If you see a large number of crack attempts on your ssh port, and your server is for personal / private use only, I'd recommend changing the default port. – jw013 Apr 27 '12 at 6:19