Raspbian Desktop Netcat script at startup

Hello Everyone!

I’m a complete beginner and I’m looking for some help.

I need to automatically start a command / script at boot to listen for a port from Netcat on computer with Raspbian Desktop version.

If I open the terminal from this computer and manually add the command like “nc -vklp 5555 | /bin/bash”, it works fine and from another computer I can access and start a script, for example “echo sudo ./test.sh | nc 5555”.

If instead I try to set the computer start listening to Netcat automatically at boot by modifying 'etc/rc.local" and adding “nc -vklp 5555 | /bin/bash” before “exit0”, it doesn’t work. Says port already in use and not working / not communicating. I have to disable it from “etc/rc.local”.

Basically, I have to start Terminal and add the command manually to listen for Netcat otherwise it doesn’t work.

Could someone tell me what I’m doing wrong?

Thank you !!!

Ps: apologize for my bad English

1 Like

Check that you didn’t mistype the port number. Port 55555 is used to communicate with the raspberryshake servers.

This is a horribly insecure way of going about it. You would be much better off using ssh to issue the command you want to run. If you don’t want to type the password each time, set up an ssh key-pair and use that.