this post was submitted on 15 Apr 2024
88 points (86.7% liked)

Linux

48186 readers
1517 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
 

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.

top 50 comments
sorted by: hot top controversial new old
[–] nik282000@lemmy.ca 59 points 7 months ago* (last edited 7 months ago) (1 children)

Do not do this. "Run as Administrator" is a Windows answer to a Windows problem. The only time you should regularly need root privileges is installing software and editing system wide configuration files.

[–] Revan343@lemmy.ca 7 points 7 months ago (2 children)

It would occasionally be handy running gparted, but for as often as I need to do that sudo gparted works just fine

[–] nik282000@lemmy.ca 22 points 7 months ago (2 children)

I've seen people say that a few times here but any time I use gparted I get the Gnome 'enter password' dialog which seems to work fine.

load more comments (2 replies)
[–] possiblylinux127@lemmy.zip 7 points 7 months ago

Gparted prompts you to enter your password so it can elevate itself to root.

[–] ikidd@lemmy.world 23 points 7 months ago* (last edited 7 months ago) (1 children)

I don't know why everyone is getting self-righteous about this. I've used Linux since the mid-90s, and occasionally I find it easier to just run a GUI file manager as root to do some filter and deletions of things in caches and such that need root permission. Hell, I want to edit the files in /etc/wireguard for my tunnels; should I only do this at a sudo prompt in the terminal when I'm perfectly capable of pulling it up in Kate and copypasting stuff in?

Get off your high horses, there's plenty of valid use cases if you're using your head.

load more comments (1 replies)
[–] dinckelman@lemmy.world 22 points 7 months ago (4 children)

Your polkit will always prompt you for a password. No need to complicate it. If it doesn't, then it doesn't need to be ran as root

load more comments (4 replies)
[–] lurch@sh.itjust.works 21 points 7 months ago* (last edited 7 months ago) (2 children)

AFAIK the newer Ubuntu gksu equivalent is pkexec, if that helps.

You could copy all system .desktop files to your home dir and automatically edit them with a script that adds an action to run them with pkexec or sudo as root. However, most GUI apps should never be run as root, because they can break the system. For example, they may create hidden thumbnail files owned by root and break thumbnails in all apps not running as root that way

load more comments (2 replies)
[–] LeFantome@programming.dev 11 points 7 months ago

I do not really see hostility or taking down. More of a difference of opinion or experience.

Also, this is not a private email thread. It is a public forum. Whatever advice you get risks becoming guidance for the community. I think it is perfectly reasonable, even responsible, for people to respond with their thoughts on security.

You can ignore the advice not to implement this capability on your personal machine. That is your call. However, this should not become standard practice by Linux users.

Thank you for answering at some point in the thread the use cases that drove your question. I was very curious.

When I have needed “Run as Administrator” in Windows, it has typically been to run the command line. The reason Windows needs this is because it has lacked “sudo”. The next release of Windows is adding it as a feature ( going the other way ).

I have used Linux for decades as well and really not needed this. Partially this is because tools that require root access are typically configured to ask for it already.

Your “need to delete a file” use case made sense to me but I do not run into it. Perhaps my file systems are mounted differently. Perhaps I am not manipulating files of other users ( sounds right ). Or maybe I am more likely to be at the command line. Your “edit files as root” use cases leads me to believe I use the command line more as that is certainly something I would be doing from the terminal. I have to edit files as root everyday but it is always from the terminal. I am not encountering files that I cannot edit in my file manager though as I would have navigated to those files in the terminal to begin with. Clicking around in a file manager to get to system files is not even something that would have occurred to me. If I am using the file manager, it is to manage my own files ( mostly media and documents ).

No judgement. Do things how you want. I was just curious what you were using this for. When I use Windows, I use “Run as Administrator” all the time. In Linux, I did not even notice it was missing. Going back to Windows makes me miss “sudo” in the terminal though. I am not the only one obviously as they are now adding it to Windows too.

[–] bizdelnick@lemmy.ml 10 points 7 months ago (4 children)

You don't need to run any GUI programs as root.

[–] olutukko@lemmy.world 16 points 7 months ago (3 children)

Now this is actually wrong. Firewall gui for example requires root. There are similar sysadmin guis that need it too

[–] bizdelnick@lemmy.ml 8 points 7 months ago

Sysadmin GUI tools are designed to be secure by isolating GUI from privileged process. That is not true for a random GUI app.

load more comments (1 replies)
[–] Rustmilian@lemmy.world 12 points 7 months ago (10 children)

No. It's ”you probably shouldn't run them with sudo” , many GUIs need root for certain tasks. I recommend using pkexec instead of sudo, you can add it to the .desktop file and when you launch the application it'll give you a GUI authentication prompt.

load more comments (10 replies)
[–] flork@lemy.lol 4 points 7 months ago (3 children)

There's one in every thread.

load more comments (3 replies)
[–] Peasley@lemmy.world 10 points 7 months ago (9 children)

What's the use case? What are you running into that you want to launch as sudo through the gui that isn't pulling up the dialogue automatically?

A few folks have argued this is unnecessary, but I'm curious about your perspective on why and when you think it would be useful

load more comments (9 replies)
[–] Nibodhika@lemmy.world 9 points 7 months ago (20 children)

Sudo is "su do", i.e. "run as root", so it's funny to hear run as sudo because it means "run as run as root", like "chai tea" or "ATM machine".

To your question the answer is "why?". You shouldn't need that, that's one of the hardest things to get rid of, the "Windows mentality", it's like when people ask how to install a .tar.gz they downloaded from the internet, the answer is most likely "you don't need that".

This leads to an XY problem, where you're asking how to solve problem Y but that is caused by you assuming you need to do X, when in fact you don't. The main clue is that people keep asking you why do you want to do this. So, what exactly is the problem you're trying to solve? Why do you think you need this?

[–] FrostyPolicy@suppo.fi 12 points 7 months ago (2 children)

Sudo is “su do”, i.e. “run as root”

It may default to root but it doesn't mean run as root. Su means substitute user identity i.e. any other user (if you have the rights to it).

[–] patatahooligan@lemmy.world 9 points 7 months ago (1 children)

Both su and sudo originally meant "superuser" because that was their only use. They have retroactively been changed to "switch user" because this functionality was added later.

load more comments (1 replies)
load more comments (1 replies)
load more comments (19 replies)
[–] ouch@lemmy.world 8 points 7 months ago (3 children)

There is a lot of advice in this thread warning you about doing this. Please heed it. Instead, read more about how permissions and file ownership works.

load more comments (3 replies)
[–] MonkderDritte@feddit.de 7 points 7 months ago* (last edited 7 months ago) (1 children)

Thunar has 'custom actions'. Add one using pkexec %f. Other FM have similiar functionality.

load more comments (1 replies)
[–] sorrybookbroke@sh.itjust.works 7 points 7 months ago

Don't know about gnomes default file manager, but dolphin has this ability. You'll have to install the addons and enable it in the context menu however.

To repeat others opinion though, I haven't actually needed this feature outside of very specific situations (that I create myself). Linux operates a bit different and shouldn't need this for anything outside of some poorly made, or potentially malicious apps and scripts. I agree though it's still nice to have the option

[–] DmMacniel@feddit.de 6 points 7 months ago (15 children)

It depends on the file browser you are using.

load more comments (15 replies)
[–] possiblylinux127@lemmy.zip 6 points 7 months ago

That's not a good idea as root isn't the same as an Administer account. Also, you might want to consider why you are running programs as root. You may have a chicken and the egg problem.

Maybe step back and give us some more context.

[–] ZWQbpkzl@hexbear.net 6 points 7 months ago (5 children)

We must first ask What GUI program are you trying to run as root?

load more comments (5 replies)
load more comments
view more: next ›