I would like to send a command with some predetermined number of arguments to a Raspberry Pi and get the output back from it. I was thinking of using restricted ssh key but was wondering if that is the best way. This command doesn't need to be sent frequently, maybe it can be sent every 10 minutes. Also the string that the command returns is about 100 characters. I'm looking for a secure and easy to maintain way to achieve this. In terms of security I think this is good but I think setting this up is a bit tedious. Is there any better way?

closed as too broad by hardillb, Sean Houlihane, Mahendra Gunawardena, Helmar Apr 26 at 9:05

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    There isn't enough information here to really help. We need to know a lot more about how the devices are connected (e.g. are they all on the same network, are they all behind NAT gateways). Also have you looked at existing IoT messaging systems (e.g. AWS Iot, IBM Watson IoT)? – hardillb Apr 11 at 12:06
  • I was thinking of the leanest way possible, so just port forwarding. I was also thinking of an ordinary home application so that would not be behind NAT gateways, I guess. So I haven't checked AWS IoT or IBM Watson IoT because that would involve more things to do than just port forwarding. – Vasco Apr 12 at 6:32
  • 1
    Home networks are nearly always behind NAT gateways and the offerings from AWS & IBM do not need any port forwarding – hardillb Apr 12 at 6:35
  • raspberrypi.stackexchange.com or, more likely, security.stackexchange.com – Mawg Apr 12 at 10:20
  • 1
    It's a pity that this question is closed, because it's an important one that when implemented incorrectly gives IoT a bad reputation for security. The short answer is your Pi should not open any ports, ever. Use a message broker (or message broker oriented IoT platform) that implements mqtt or similar protocols. For a longer answer an reasons look for “Service Assisted Communication for Connected Devices" – Simon Munro Apr 26 at 12:15