Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

adammench's avatar

Change default SSH port to 1222

Hi!

I have successfully installed laravel forge onto a custom VPS, and Forge can connect to it.

I would like to restrict SSH to port 1222. Of course when ssh'ing in myself I can specify the port... But is there a way to tell Forge to connect via a different port?

Thanks in advance guys.

0 likes
7 replies
adammench's avatar

Bump.

Has anyone achieved this, ensuring Forge can still connect?

ivanv's avatar

I tried this, but I couldn't specify a port anywhere on Forge. You can't enter something like ip:port either in the server IP setting.

Would be nice tho, maybe I could get rid of some of those bots trying to SSH in all the time then :)

michaeldyrynda's avatar

You can always setup a firewall rule to forward traffic on the default port to 1222 for traffic coming only from Forge servers, and block everything else on 22.

2 likes
ivanv's avatar

Got any good references/tutorials on how to achieve this?

bashy's avatar
bashy
Best Answer
Level 65

Changing the port to something else won't help much. Just install fail2ban and it will ban them (and anyone else doing login fails).

3 likes

Please or to participate in this conversation.