No protocol specified; Cannot open display


2 posts
by animal99 » Thu Jul 04, 2013 3:04 pm
Hello All,

I have an issue that is driving me nuts.

My pi is set up with a monitor running the desktop. I do not want to connect it with a keyboard or mouse and I have enabled ssh. I just want to run a slideshow of photos using feh and occasionally restart it when I upload new photos.

With the desktop running on the pi, I ssh into it using Putty from my PC. I can run feh from the command line in Putty and it will pop up on the monitor connected to the Pi. However, if I put that command in a bash script I get the following error:
No protocol specified
feh - Can't open X display:

I have tried X11 forwarding in Putty, export DISPLAY=:0 in the script and can't get it work. Why does it work one way and not the other?

Code: Select all
#!/bin/bash
#
export DISPLAY=:0

/usr/bin/feh --quiet --recursive --randomize --full-screen --slideshow-delay 5 /home/pi/photos/ &

exit 0
Posts: 2
Joined: Thu Jul 04, 2013 2:37 pm
by animal99 » Sat Jul 06, 2013 4:35 am
Using this command seems to have solved the problem:
xhost +
Posts: 2
Joined: Thu Jul 04, 2013 2:37 pm