Use "Cloud Providers" > Custom with a SSH server on a port other than 22

I'm trying to use a target on a server that doesn't have SSH on the default port 22; it's on port 2222, and that's causing an error.

I did the same test on a server traditionally on ssh port = 22 and it works.

Error when create the service.

However, when we create the target, the connection under test returns OK.

Error present in the console.

Test on the same machine where Wappler is installed and using the same public SSH key.

Can someone help me?

Hi Thiago,

I believe you're trying to import an existing remote server with Port 2222 in the IP address. Wappler doesn't expose a field to change the SSH port, and it assumes port 22 by default.

Additionally, these port settings are not available in config.json, so there are no files that can be edited manually to change the SSH port. You are limited to use SSH port 22 until Wappler opens up access to further customisations of remote targets.

1 Like

If you have root access to the box you could change port 2222 to 22 (if your host allows such changes to be made). You can try but some hosts may automatically revert the change back to 2222.

VERY IMPORTANT!! Check the firewall allows for connections on port 22 before making these changes! If not enable it! Otherwise you'll be locked out of SSH obviously.

Log in via SSH:

sudo nano /etc/ssh/sshd_config

Locate where the port is defined to 2222.

Change 2222 to 22.

Write the file and save.

Restart SSH:

sudo systemctl restart sshd

And verify the changes (remember you'll more than likely get booted from your current SSH session and will have to connect via port 22 on the next connection as 2222 will no longer be listening for connections):

ss -tlnp | grep ssh

That is if you are desperate to do so and can't wait for a fix... Also no harm done if it is just a new Droplet. If it all goes wrong just delete the Droplet and create a new one...

Feature Request @guptast

:innocent:

1 Like

Sorry I forgot to say you can define two or more ports in the SSH config (just remember to check the firewall and whatever port you add is open). So you could keep 2222 and add 22, just specify:

Port 22
Port 2222

Thanks for the feedback everyone.....this feature of changing the SSH port is very interesting because here in Brazil many providers don't allow port 22 for security reasons in some environments. Locally it works because on the internal network I have autonomy, but doing this externally requires accessing SSH on a port other than 22.

It would be great if Wappler could offer more flexibility and customisation options for remote servers and Docker :slight_smile:

1 Like

Exactly, I have a VPS at Contabo and it was easily configured in the custom settings, however I was unsuccessful on a server in a corporate environment where the server has to be located at the company and the local internet provider doesn't directly open the port, so I created a route from the external port 2222 to the internal port 22 where the server is physically located.