About running GUI applications as root
Avoid running graphical applications as root if possible.
Edit file using GUI as root
The wrong way!
Never use sudo xed , sudo gedit or any sudo on GUI application to avoid to create file owned by root into your configuration.
The expected way
Access to privileged files and directories is possible through GVFS by specifying the
adminbackend in the URI scheme.
To access the expected file just add
xed admin:///etc/default/grub gedit admin:///etc/samba/smb.conf
This mean than you can also use any URL like:
Of course you cannot save on the web site like this !
Run other GUI applications
To run GUI applications as root (not editor) and for same reasons, you shouldn't use
sudo APP2RUN directly.
You must add following options to run into the root environment.
-u root : ensure to use root user
-i: run the shell specified by the target user's password database entry as a login shell.
Finally you have something like:
sudo -u root -i gparted
xhost - server access control program for X
✍ TODOC ✍
xhost si:localuser:rootwill allow to run those apps as root.
xhost -si:localuser:rootto remove permission afterwards.