Why xdg-open should not be used as root?
Solution 1:
As you may know xdg-open
is used to open a file or URL in the user's preferred application.
If you run it using root
, you may end up with a broken system, but why?
Because you may run a graphical program using root
access ( Why should users never use normal sudo to start graphical applications? ).
It may also run a program which shouldn't be run with root
access or even accidentally run a dangerous command using root
access.
xdg-open
may simply run a command of which we are not sure of its results, so it shouldn't be run with root
access.