Fbi has no access to tty when run as non-root user

1k Views Asked by At

Fbi is a framebuffer image viewer that does not need an X-server setup. It's perfect for what I want to achieve: a stand alone dedicated slide show.

I want to run the following command as a non-root user:

fbi -d /dev/fb0 -T 1 foo.jpg

When I run fbi as non-root, the result on tty1 is:

access /dev/tty1: Permission denied

I can perfectly run the command as root (sudo ...), but that's not desirable. My question is: how can I run fbi as non-root user on a tty?

The setup of the rpi4 is "headless": no X-server installed, the fbi command is issued from ssh or crontab, the output tty1 is a screen connected to a HDMI port on the rpi4.

I tried many things:

  • checked all possible forums, many of which address this problem without giving a satisfactory solution. The man page for fbi suggests adding the user to the vido and tty groups which I did but to no avail.
  • added the user to the groups tty and video
  • changed permissions on tty1 and fb0 to 666. Interestingly the error message changes to ...

ioctl VT_ACTIVATE: Operation not permitted.

Of course, after reboot the permissions of the /dev/tty1 and /dev/fb0 change back to normal. So changing these permissions is no good idea at all, even if it would work, which it doesn't.

Thanks you guys for your help!

1

There are 1 best solutions below

5
On

I'm running bullseye on a rpi3.

Here is how I got it to work (from inside a docker container fwiw):

  • [x] add the user to the tty and video groups
  • [x] change permission on /dev/tty1 to allow group read
  • [ ] grant capability CAP_SYS_TTY_CONFIG to the fbi binary

The last part is what you missed (the cap).

One liner to get it:

setcap 'cap_sys_tty_config+ep' $(which fbi)

[UPDATED]

Also, to persist the permission on the tty on raspbian, look into

cat /usr/lib/udev/rules.d/50-udev-default.rules | grep "\"tty\[0"