Today, however, I was doing some research on SSH VPNs and I stumbled across the solution.
ssh -nNT -R [rp]:localhost:[lp] [myDesktop]This version of the solution will have lappy automatically build a tunnel to the SSH server on myDesktop that can then be used to connect back to the SSH server on lappy. Once I can connect back into lappy I (or you) can then initiate and stream the webcam feed.
[rp] = port on [myDesktop] to open
[lp] = lappy SSH server port
[myDesktop] = desktop server at my house
Here's the step-by-step starting from zero, but assuming a certain level of technical experience:
- On myDesktop (WinXP):
- Install VLC Media Player.
- (optional) Install a DynDNS client.
- Install an SSH server. I used Cygwin's version.
- Configure port forwarding on your router.
- On lappy (EeePC 701 w/ Ubuntu):
- Install VLC.
- Install OpenSSH.
sudo apt-get install openssh
# be sure to edit /etc/ssh/sshd_config to suit your needs - Configure Key Based Auth with myDesktop.
- Create the script to automatically build the tunnel (./tun.sh).
#!/bin/bash
Make this script executable and put it in your startup list so that it will automatically initiate the tunnel when the script detects a connection on eth0 or ath0.
CONNECTED=NO
while true
do
if [ $CONNECTED=NO ]
then
if [[ `ifconfig ath0 | grep "inet addr:"` || `ifconfig eth0 | grep "inet addr:"` ]]
then
CONNECTED=YES
ssh -nNT -R [rp]:localhost:[lp] [myDesktop]
fi
fi
sleep 600
doneSystem > Preferences > Sessions > (add the ./tun.sh script)
- Create the script to send the webcam stream (./vlcspy.sh)
#!/bin/bash
Make this executable also since this is the script you'll run when you connect to your lappy from your desktop.
vlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-adev=/dev/dsp :v4l2-standard=0 :sout="#transcode{vcodec=mp4v,vb900,scale=1,acodec=mpga,ab=129,channels=2}:duplicate{dst=std{access=http,mux=ts,dst=localhost:9091}}" - Connect to the internet.
- On myDesktop:
- Open an SSH tunnel connection to localhost:9090...
PuTTYHostname = localhost
Linux
port = 9090
connection > ssh > tunnels >
source port = 9091
destination = localhost:9091ssh -L 9091:localhost:9091 localhost -p 9090
- Run your ./vlcspy.sh script.
- VLC Player > Media > Open Network ... > HTTP > localhost:9091
- Enjoy!
- Open an SSH tunnel connection to localhost:9090...


1 comments:
you can just use
ssh -L 9091:localhost:9091 localhost -p 9090 'vlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-adev=/dev/dsp :v4l2-standard=0 :sout="#transcode{vcodec=mp4v,vb900,scale=1,acodec=mpga,ab=129,channels=2}:duplicate{dst=std{access=http,mux=ts,dst=localhost:9091}}"'
Post a Comment