Other threads:
You are free to do anything and everything with Linux!
ITT:
YOU CAN'T DO THAT
Other threads:
You are free to do anything and everything with Linux!
ITT:
YOU CAN'T DO THAT
This is very easy in KDE but Desktop entries work the same on all Desktops.
See this post where I mentioned how to do this with running Konsole with root.
In general, use polkit instead of sudo, every desktop has a GUI dialog that pops up.
pkexec APPNAME
And add this as a desktop action, following the guide.
[Desktop Entry]
Type=Application
Exec=konsole
Icon=utilities-terminal
Categories=System;TerminalEmulator;
Actions=root
Name=Konsole
GenericName=Terminal
Comment="$GenericName"
[Desktop Action root]
Name=root
Icon=folder-root-symbolic
Exec=pkexec konsole
In the specific case of Konsole you could use a profile instead.
Be aware that nearly no program should be ran as root. Also not Konsole. The program is ran as the user, and can enter a root shell, but never run random apps as root. Not even many terminal apps are made to be ran as root, for example use sudoedit
instead of sudo nano
for editing files.
To view and change system files in KDE, type admin:/
into the location bar.
Running apps as root doesnt work with Wayland, and for a good reason.
For context, I answered this after your edit. First, I don't know how to add another context menu on a file manager, but I imagine if there is a way to do that, there is a command to be run when doing it. Hence, what I will answer is only the command.
For editing a file, you absolutely don't need to open the editor as root. You can however, make a temporary copy of a file that your own user has access to, edit those temporary files, and when you are done editing it just replace the old file. This is what sudoedit FILE
does.
Secondly, for manipulating a file, I agree with the other commenter that it still is a bad practice to run the file manager as root. Instead, try to add a context menu for taking ownership of a file/folder recursively. chown
does exactly that. Of course chown won't save you if that file is a network mount with some form of other access control.
Third and last, yes I agree that if a user wanted to nuke their installation it is their right to do so. However, do remember that this is also a forum and that we always remind each other the best practice since maybe another user will stumble upon this and think "oh, this is how it is in Linux". We do not have the equivalent of "Run as Administrator" here in linux as that would mess up a lot of assumptions for other programs and easily make the system unstable or outright unusable.
something like this? creating custom context menu options
I'm assuming you're using the nautilus file manager. I found this post in adding right click actions to nautilus: https://askubuntu.com/questions/210192/how-can-you-add-an-item-to-the-right-click-menu-in-nautilus-without-nautilus-ac#672553 You could make a bash script like shown in the post and use polkit to open the password prompt and run a command as root.
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0