89
submitted 5 months ago* (last edited 5 months ago) by flork@lemy.lol to c/linux@lemmy.ml

I found a (lengthy) guide to doing this but it is for gksu which is gone. I have to imagine there's an easy way. I am running Ubuntu. There is no specific use case, it is just a feature I miss from windows.

EDIT: I always expect a degree of hostility and talking-down from the desktop Linux community, but the number of people in this thread telling me I am using my own computer that I bought with my own money in a way they don't prefer while ignoring my question is just absurd and frankly should be deeply embarrassing for all of us. I have strongly defended the desktop Linux community for decades, but this experience has left a sour taste in my mouth.

Thank you to the few of you who tried to assist without judgement or assumptions.

(page 2) 50 comments
sorted by: hot top controversial new old
[-] TurboHarbinger@feddit.cl 3 points 5 months ago

Other threads:

You are free to do anything and everything with Linux!

ITT:

YOU CAN'T DO THAT

[-] boredsquirrel@slrpnk.net 3 points 5 months ago* (last edited 5 months ago)

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.

load more comments (2 replies)
[-] bitfucker@programming.dev 3 points 5 months ago

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.

[-] breadsmasher@lemmy.world 2 points 5 months ago
[-] KaninchenSpeed@sh.itjust.works 1 points 5 months ago* (last edited 5 months ago)

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.

load more comments
view more: ‹ prev next ›
this post was submitted on 15 Apr 2024
89 points (86.8% liked)

Linux

47298 readers
857 users here now

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.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS