0

I'm new to the Pi, and have come across heaps of streams that seem to need you to pair using the same IP before they will play - Openload etc...

I read and found you can create a socks proxy that will let you route the traffic from your computer through the Pi, and hence have the same IP - making it simpler to pair and then play the stream.

This seems to work well: ssh -o ServerAliveInterval=60 -D 0.0.0.0:8888 10.0.1.100 and once this is done, I can set the Socks proxy of the PC/Mac to 10.0.1.100:1080.

My question is how oh how can I get this command to run automatically when the Pi starts up? I'm running OSMC, and have tried just about everything I can think of to get it to run; the closest I seem to have got is creating a script with this in, then setting the script to run in /etc/rc.local. If I just run it like this, it always gives permission denied - presumably because it is trying to run it as root...

When I run it as my logged on user (osmc) it runs fine, but I'll be stuffed if I can figure out how to get it to run automatically at startup. If any one is able to help me get this going, I'd be incredibly grateful - I've been trawling the web trying everything I can see for about four hours :-)

Fabian
  • 1,288
  • 1
  • 10
  • 19
dmr
  • 3
  • 2

1 Answers1

0

Starting services at boot we use systemd. Try this:

rpi ~$ sudo systemctl edit --force --full socksproxy.service

Insert this statements, save them and quit the editor:

[Unit]
Description=My Socks Proxy
Wants=network-online.target
After=network-online.target

[Service]
User=osmc
WorkingDirectory=/home/osmc
ExecStart=/usr/bin/ssh -o ServerAliveInterval=60 -nNT -D 0.0.0.0:8888 10.0.1.100

[Install]
WantedBy=graphical.target

Enable, start and check the service:

rpi ~$ sudo systemctl enable socksproxy.service
rpi ~$ sudo systemctl start socksproxy.service
rpi ~$ systemctl status socksproxy.service
rpi ~$ journalctl --unit=socksproxy --pager-end

You can modify the service, no need to reboot:

rpi ~$ sudo systemctl edit --full socksproxy.service
rpi ~$ sudo systemctl daemon-reload
rpi ~$ sudo systemctl restart socksproxy.service

Check status and journalctl as shown above. You can show a Unit source with:

rpi ~$ systemctl cat socksproxy.service
Ingo
  • 42,961
  • 20
  • 87
  • 207