So what can I do when using Lubuntu focal?
What if I want to use GUI applications with root privileges? People say “don´t use sudo for GUI apps”. That´s done with “gksudu”.
when the need arises to modify a certain config file which needs root privileges to be handled and I want to use a graphical text editor (like gedit).
Well, I know the answer to this one: “sudo nano […]” in the terminal.
what about this one: copying files from “/” to “/home/rosika/[…]” within a graphical file-manager (like thunar) and two tabs open.
O.K., this can be done via terminal as well: “sudo cp […]”
But what if I want to use grub-customizer (https://launchpad.net/grub-customizer ).
This is definitively a GUI application and as far as I know it needs root privileges.
Thanks again for your help.
Many greetings.
Rosika
Editing files with a graphical editor is a very good example of a case, where the editor itself does not need to run with elevated privileges.
If you have the admin:// backend installed (for example, when you use GNOME, doesn’t work on Lubuntu), then you should be able to edit files with:
gedit admin:///path/to/file
In general the better solution is to use sudoedit:
VISUAL=gedit sudoedit /path/to/file
If you always use the same graphical editor, you can add export VISUAL=gedit to your ~/.bashrc, close the terminal and reopen it.
Then you only need
sudoedit /path/to/file
In both cases, the editor is not running with elevated privileges.
It depends on the file permissions. Usually, you can copy files from / without problems. If the file manager is running with normal user privileges, the copied files will also have the correct permissions and owners.
If you are running the file manager with elevated privileges, the copied file in your ~ will have root as owner.
If your file manager needs elevated privileges to copy files from another location to your home folder, than the files are quite special.
If a graphical application really needs elevated privileges, it usually has a PolicyKit action. In the case of grub-customizer it is /usr/share/polkit-1/actions/net.launchpad.danielrichter2007.pkexec.grub-customizer.policy and you should be able to start it with
thank you so much for you very detailed explanation.
I didn´t even know of the existence of sudoedit.
Curious as I am I looked it up with locate sudoedit and indeed found it here: /usr/bin/sudoedit .
echo $VISUAL yielded nothing on my system. So I think
should be fine.
O.K. If I´m not completely mistaken that was the case once or twice but I cannot recall what files I was dealing with at the time. All I know is that due to permissions lacking I couldn´t copy the respective files from within the file-manager.
But in those rare cases I can certainly do the action from within the terminal.
Taking a look at PolicyKit actions with ll /usr/share/polkit-1/actions/ I was astonished to see how many programmes and apps have an entry there.
I have to admit I didn´t know about that either. Thanks for letting me know.
So the pkexec command will come in handy when really needed.
Many thanks again for your help. It´s highly appreciated.
BTW:
About a week ago I´ve done a clean install of Lubuntu 20.04.1 (which has become 20.04.2 by now as I noticed).
Previously I was using Lubuntu 18.04 but a clean/fresh install was needed bcause of the change of DE.
In the meantime I´ve grown accustomed to LXQt and I really like it very well.
Thanks again and keep safe.
Many greetings from Rosika