Hi My ssh code is working on local network. I can turn my printer's lights off and on. But it throws an error on the public network. I set port no 2222 in ssh settings. Is there anything else I should do? From modem vs. Do I need to adjust?
I strongly advise against forwarding your ssh server to the internet.
It's way too dangerous if you don't know what you're doing - and you, no offense, seem to not know what you're doing.
There are people out there scanning the internet for vulnerable ssh servers all the time. It's not worth the risk.
I would go with one of the led plugins and use a safe remote connection access plugin.
I use the example of the firmware updater plugin for OctoPrint to discourage people from using little or no security, on the basis of 'it won't be found'. If you can flash your 3D Printer firmware, you can cause significant damage. Remember, that puts you in full control of heaters and motors - they don't have to work like a printer if you are acting maliciously.
What is your alternative to open cpio pin? I am a software developer. I do not understand how a pin connected to the led on-off will be a problem.
The problem isn't a GPIO pin connected to the LED on/off, the problem is giving access to hardware in your home from a public network.