3
   **xdg-open is for use inside a desktop session only. It is not  
   recommended to use xdg-open as root.**

Why does the manual page say the above ?

Ravexina
  • 55,668
  • 25
  • 164
  • 183
aspiring1
  • 143

1 Answers1

2

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.

Paul
  • 4,511
Ravexina
  • 55,668
  • 25
  • 164
  • 183