NOTE: the default port for ssh is 22, and when you allow ssh
below, that's the port that will be allowed. If you configured your vps
to login using a different port, you must use sudo allow <portnumber>
instead (i.e. sudo allow 2222
if your port is 2222).
- This is very important, or you will lock yourself out of ssh!
$ sudo ufw allow ssh
or
$ sudo ufw allow 2222
$ sudo allow 80/tcp
$ sudo allow 443/tcp
Once you're done you can check your status using sudo ufw stats
and will see something like this:
22 ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
12543 (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)