0

enter image description here

I'm new to ufw, and followed this link and entered exact command as instructed.

ufw allow ssh 2222

Since my SSH is 2222, I want to add that rule in, but I kept getting

ERROR: Need 'to' or 'from' clause

Any hints for me ? I don't want to get lock out.

3

1 Answer 1

4

The ufw man says:

Example rules using the simple syntax:

     ufw allow 53

This rule will allow tcp and udp port 53 to any address on this host. To specify a protocol, append '/protocol' to the port. For example:

     ufw allow 25/tcp

This will allow tcp port 25 to any address on this host. ufw will also check /etc/services for the port and protocol if specifying a service by name. Eg:

     ufw allow smtp

So if you say

ufw allow ssh

it is the equivalent of

ufw allow 22/tcp

In your case it would work if you put just

ufw allow 2222

or

ufw allow 2222/tcp

since I guess you don't need udp...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .