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.
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?
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).
Both
su
andsudo
originally meant “superuser” because that was their only use. They have retroactively been changed to “switch user” because this functionality was added later.Just citing a source in case anyone wants a little history: su.
I know, but explaining all that for just a comment on why I found funny the “run as sudo” seemed too much.
I think you are right that people want a solution to a problem they don’t have, but I think in this case they may just want to run executable files as sudo from a GUI.
Which program/files and from which GUI? Each GUI will have it’s own way of doing that, and on 99% of cases it’s not necessary. He consistently refuses to answer simple questions about what he’s ultimately trying to accomplish. I have a generic way of doing that, login with the root user. Do you think that’s a bad idea? Then list all of the reasons why using root as your main user is a bad idea and probably every single one will apply to what he wants as well. There’s a reason why programs that need root access ask for it and don’t expect you to run them with sudo, the “run as administrator” is a windows concept from an OS that doesn’t have a proper way to elevate privileges so programs can’t implement that API and you need to elevate the entire program.
There is no reason to assume this is an XY problem scenario.
Yes there is, you’re asking how to add a menu entry to run things with sudo, and refuse to answer why you want to do it, what’s your use case? What graphical application do you need to run with sudo and why?
I’m almost sure I know why, and your refusal to answer this even though it’s been asked multiple times seems fishy. Like it was explained multiple times there’s a 99% chance that you don’t need it, and there is a package for the remaining 1% or you could do it manually like others have suggested. But until we know your use case we can’t help you, so while you keep refusing to explain what is it that you’re actually trying to accomplish and why do you feel you need it it will be impossible for anyone to help you.
What I want to accomplish is to open files and programs as root without use of the terminal. I promise you I have no nefarious intentions towards you or your ilk.
For files, you should use an editor that supports it (e.g. Kate via admin:// paths). You should not run GUI programs as root.
Or
sudoedit
in console.What program? What files? Why do you need to run them with sudo? You’re either being purposefully vague or you don’t even know why you think you need this.
The question is not about a specific use-case, but a general one. An alternative reading would be “Is there a way to run short commands as root without switching to the terminal?”
I have had to un-teach dumb things that people learn from Windows.
A menu item to run a GUI program as root it is indeed a rather absurd scenario. It suggests that you want to violate the admin/user barrier which is intended to be difficult to surpass except in certain circumstances.
There can be a lot of things under the hood that are necessary to run a GUI program as root depending on whether you’re using X11 or Wayland or something more esoteric. It’s doable though.
But instead of doing that, why not just learn how to use the command line? Every administrative task can be done via the command line, but not every administrative task has a GUI counterpart. So you’re going to need to learn to use the command line sooner or later.
OP asks a relatively simple question, and gets scolded as it committed murder.
For all we know OP is the only user and is just playing with Linux, and just wants a simple (probably unnecessary) shortcut because he’s GUI oriented.
This is kind of someone asking how to open their lunchbox easier, and get treated like they are giving a copy of their house keys to everyone in town.
Chill… Not everyone is running a maximum security level server. If OP screws their system (like most of us do at some point), I’m sure a fresh re-install would be enough for them.
It’s a relatively simple question, but it’s a loaded question, it’s like someone asking you how you run “apt-get upgrade” on Windows, the question implies that this is possible and necessary, the correct answer to any such question is “what is it that you’re trying to accomplish? Why do you think you need this?”. 99% of the times the answer is that the person is trying to do something else entirely, this is known as the XY problem, the person has problem X and is asking how to solve problem Y that he’s having because he thinks that’s the only way to solve X.
In OP’s case he caused the issue by running one program as root, and then everything that program touched needs root now, so he needs to run things as root because he’s running things as root, it’s a cyclical problem, if he had never ran things with sudo he wouldn’t need to run things with sudo. Everyone was asking him why he feels he needs that and he wasn’t answering, in one answer he let it slip his original mistake that caused all of this headache.
Yes, the community can be a bit toxic sometimes, but if everyone is asking you “why you think you need this?” There’s a good chance you don’t, and if you refuse to answer the questions of people who are trying to help you, you make it real hard to be helped.
Thank you lol this thread got absurd.
“I won’t tell you to open your lunchbox until you tell me what you brought for lunch and the allergies of anyone in your family.”
It is, run as administrator is a windows concept, in Linux programs that need elevated privileges will ask for it, so if you need a specific program to be entirely elevated you’re asking something quite unique. I’ve asked multiple times, I’ll ask again, why do you want this? Give me a concrete example of what you’re trying to do, just saying running any program as root is not a good answer.
Since I know you’re not going to (because I already asked at least 3 times and others have as well and you haven’t answered anyone, so I think you don’t know why you want this other than “because Windows has it”), here’s the generic answer for you, on the login screen type root as your user and input your root password, there you go, you don’t even need that menu item anymore since everything runs as root now, just like in Windows.