LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   ssh X11 Forwarding works, but I cannot view webcam through it. - testing with spcagui (http://www.linuxquestions.org/questions/linux-software-2/ssh-x11-forwarding-works-but-i-cannot-view-webcam-through-it-testing-with-spcagui-648314/)

Anithen 06-10-2008 10:58 AM

ssh X11 Forwarding works, but I cannot view webcam through it. - testing with spcagui
 
X11 forwarding has always worked, but I'm working on a project for a computer that is only going to be used for neighborhood time lapse videos and household security (using motion). I can use spcagui when I physically visit the computer and use it. I can use xawtv and mplayer to view live camera feeds, too. This is good so that I know the camera drivers (gspca) work, but here's what happens when I try using spcagui via ssh x11 forwarding:

government@egomenace:~$ spcagui
SpcaGui version: 0.3.5 date: 18 September 2005
video device /dev/video0
ERROR opening V4L interface
: Permission denied

If I try as root, I get:

SpcaGui version: 0.3.5 date: 18 September 2005
video device /dev/video0
Camera found: Logitech QuickCam EC
VIDIOCGPICT brightnes=16384 hue=0 color=0 contrast=8192 whiteness=0depth=24 palette=4
Bridge found: SPCA561
StreamId: GBRG Camera
Available Resolutions width 352 heigth 288 native
Available Resolutions width 320 heigth 240 native
Available Resolutions width 176 heigth 144 decoded
Available Resolutions width 160 heigth 120 decoded
grabbing method default MMAP asked
VIDIOCGMBUF size 2457616 frames 2 offets[0]=0 offsets[1]=1228808
VIDIOCGPICT brightnes=16384 hue=0 color=0 contrast=8192 whiteness=0depth=24 palette=4
VIDIOCGPICT brightnes=16384 hue=0 color=0 contrast=8192 whiteness=0depth=24 palette=4
VIDIOCGPICT brightnes=16384 hue=0 color=0 contrast=8192 whiteness=0depth=24 palette=4
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X connection to localhost:10.0 broken (explicit kill or server shutdown).
X connection to localhost:10.0 broken (explicit kill or server shutdown).

Now, that makes it look like root would be able to do it if I added an entry to ~/.ssh/config, like:

Host nomind
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
Protocol 2,1
user root

I don't think that will work, but I'll try it and report back. Also, I don't want root running spcagui all of the time, so even if it works I need to find a away for a normal user to do this.

Does anyone have any ideas? I don't see mention of my problem on google, so I really appreciate it.

-Anithen

Anithen 06-10-2008 11:36 AM

Alright, my setup denies x11forwarding to all except those listed in .ssh/config. I added root there (on both machines for the experiment, just to make sure) and restarted sshd on both computers. That idea didn't work. I actually get the same root error that I got before.

Why don't I just allow the camera to take auto snapshots with camE for the timelapse? I might do that, but getting a live feed is preferred in some instances. These cameras are on the same usb bus, so they won't work at the same time, so I'll be having motion running continuously with one camera, and then if I use spcagui via ssh it will be in a wrapper script that produces the motion kill file to stop motion before starting the live feed of outside. It would be different from where motion is looking. I'm not sure, but I believe that if I cannot get spcagui working through x11 forwarding, that I will also not be able to halt motion and start something like camE to take snapshots on the fly, because the error indicates that the user is not able to access the v4l interface, not even referring to an X problem.

So, after work I'll be trying:

-Looking back at this post for answers :)
-Using ssh to start camE daemon, after which I could run feh on a batch or something similar.
-Reading V4L documentation
-I've already tried this on different computers with same outcome
-New google search strings for answers


Thanks for any help you guys can give,
Anithen

Anithen 06-10-2008 11:50 PM

I hit up a couple of v4l articles while @ work, and saw that -- no matter what the project -- people who experienced any sort of permission denied message for a /dev/video* or any other v4l interface were mostly able to fix it with chmod 666 /dev/video0 .

I ran chmod 666 on /dev/video1 and video0, and everything's fine now. Enjoy!

Anithen 06-11-2008 11:34 AM

RE: Solution
 
chmod 666 /dev/video* works for webcam viewing via ssh x11 forwarding, but here's a note to all who read this -- a pitfall warning:

If you ls -l /dev/video0 and /dev/video1, you will notice that it looks like everyone has read, write and execute privileges. I almost didn't even try chmod 666 because of this. I thought to my self "doing that would make them the same as they are now." I ran the command, checked ls -l on the devs and the permissions looked IDENTICAL.

Tried spcagui, and it worked, though. Just goes to show that sometimes experimentation is the only way, because if I would've just followed my head and eyes, I would've skipped the chmod 666.

Anithen 06-13-2008 03:47 AM

Another, more secure solution
 
I made a user with adduser and made him part of the audio and video group. That allowed him to access /dev/video*. Strangely, after doing that all users were able to access the dev. I haven't tried reproducing this, but if anyone experiences it, so have I.


All times are GMT -5. The time now is 09:33 PM.