LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-06-2012, 09:30 PM   #1
Maxuuma
LQ Newbie
 
Registered: Oct 2012
Distribution: CentOS 6.3
Posts: 7

Rep: Reputation: Disabled
Convenient way to run as root?


Hi,
I'm testing CentOS 6.3. I'm a Windows sysadmin but I'm trying to learn Linux.

I'm wondering if there's a convenient way to run a gui app as root, e.g. shift+right-click the shortcut > run as....

So far, the only things I have found are:
Do it from a console, using su. This requires knowing the name of the app, either by memorizing every app you could possibly want to run elevated, or finding the name of the app somehow. It's slower than a right-click, and requires time to memorize or find the name of the app, so it's not convenient (true, some app names are exactly the same as their default name in the menu).

Or, create a shortcut for the app that will always launch it elevated. This would require creating a new shortcut for each app, which is slow and would muck up the menu.

Or, create a script that runs Nautilus as root, then search through the folders until you find the app you want, and click on it.

Has anyone created something that allows one to conveniently elevate an app from its existing shortcut?

Thanks!
 
Old 10-06-2012, 09:51 PM   #2
Knightron
Senior Member
 
Registered: Jan 2011
Location: Planet Earth
Distribution: Slackware.
Posts: 1,324
Blog Entries: 7

Rep: Reputation: 157Reputation: 157
Since you mention Nautilus and it comes as default in CentOs, i'm assuming you're using Gnome. You can use a program called gksu. Once it's installed, and it may be already. Open the terminal and as you normal user, initiate the command.
Code:
gksu nautilus
It will prompt you for your root password and then it'll open the nautilus as root. Be careful with this because nautilus is the program that manages the desktop in gnome as well as being a file manager. Some distribution actually have a option in the menu to open the file manager as root, but i'm unsure how distributions set this up.
 
Old 10-06-2012, 09:57 PM   #3
Maxuuma
LQ Newbie
 
Registered: Oct 2012
Distribution: CentOS 6.3
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks for the quick reply.
As mentioned in my first post, I had come across that option. But I'm looking for a way to way to do this from the Application menu, so that I don't have to dig through the file manager to launch the application I want, which really wouldn't be making things any more efficient for me.
 
Old 10-06-2012, 10:04 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Rep: Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979
You may not want to hear this, but as a Linux sysadmin you are rarely configuring systems via a GUI, so learning the commands is the first thing to do. You will very seldom find a server with a GUI even installed. I would strongly recommend to learn how to do it from the command line.
 
Old 10-06-2012, 10:56 PM   #5
Maxuuma
LQ Newbie
 
Registered: Oct 2012
Distribution: CentOS 6.3
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thank you for the prompt reply.

That is really awful news, though. I like getting things done as quickly as possible. The fewer commands I have to memorize and type, the more efficiently I can learn and implement new solutions. I can understand that CLI has its place (e.g. Server 2008 Hyper-V and Core domain controllers, very little gui to reduce overhead and because it wouldn't add much). But for pretty much everything? Not good at all.
 
Old 10-06-2012, 11:15 PM   #6
John VV
Guru
 
Registered: Aug 2005
Posts: 12,600

Rep: Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677
even on a desktop install i tend to do about 50% to 75% of EVERYTHING in the terminal

you might want to LEARN to use it

VI is cool

running X11 as root is not that great of an idea and servers normally have NO gui to run

"sudo" if mis-configured is a very large security hole
it has it's uses BUT

Code:
su -
---- root password ---
vi

Last edited by John VV; 10-06-2012 at 11:21 PM.
 
Old 10-06-2012, 11:49 PM   #7
Maxuuma
LQ Newbie
 
Registered: Oct 2012
Distribution: CentOS 6.3
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by John VV View Post
even on a desktop install i tend to do about 50% to 75% of EVERYTHING in the terminal
I can do most things from CLI in Windows as well. But why would I if I can accomplish the same thing with a GUI in a fraction of the time as it takes to type everything out (even if you never fat-finger it).

Quote:
Originally Posted by John VV View Post
you might want to LEARN to use it
No, I really don't. But if it's the only way then I will.

Quote:
Originally Posted by John VV View Post
servers normally have NO gui to run
That's fine. I don't stand in front of every server I administer, or even RDP to them. I run the GUI (RSAT, MMC, etc) on my desktop or management server.

Some people may enjoy typing commands all day. I enjoy getting things done. If I can replace dozens of keystrokes with a couple mouse clicks, I'll get more done. And that's why I asked my original question. I think I read it's been done in Linux Mint, but that's not the distro I'm trying to use.

Thanks.
 
Old 10-07-2012, 02:47 AM   #8
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 3,718

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
Quote:
Originally Posted by Maxuuma View Post
Or, create a shortcut for the app that will always launch it elevated. This would require creating a new shortcut for each app, which is slow and would muck up the menu.
Why would you want to launch every program/app with root privs? If you are going to do that, you might as well login as root.....

I can understand wanting to run a program like nautilus occasionally as root. If you think you need root privs all the time with nautilus, either you are doing something wrong or you are still stuck in a windows 'I always run as admin!' mindset.
 
Old 10-07-2012, 03:55 AM   #9
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 6,858
Blog Entries: 51

Rep: Reputation: Disabled
Quote:
Originally Posted by Maxuuma View Post
If I can replace dozens of keystrokes with a couple mouse clicks
You had to use dozens of keystrokes to type these posts to LQ, or did your mouse do it?
 
Old 10-07-2012, 04:55 AM   #10
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by Maxuuma View Post
Thanks for the quick reply.
As mentioned in my first post, I had come across that option. But I'm looking for a way to way to do this from the Application menu, so that I don't have to dig through the file manager to launch the application I want, which really wouldn't be making things any more efficient for me.
The only way that I'm aware of is by logging in as root into the GUI.
Quote:
Originally Posted by brianL View Post
You had to use dozens of keystrokes to type these posts to LQ, or did your mouse do it?
Ah, cynical Brian Surprised that you forgot about voice recognition
 
1 members found this post helpful.
Old 10-07-2012, 05:14 AM   #11
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 6,858
Blog Entries: 51

Rep: Reputation: Disabled
Quote:
Originally Posted by Wim Sturkenboom View Post
Ah, cynical Brian Surprised that you forgot about voice recognition
Yeah, I did. Silly me!
 
Old 10-07-2012, 09:17 AM   #12
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Really, this is all just a lot of Windows-think being expressed here. The Windows mentality is that it is inefficient to have to think or learn things about the tool being used. The Linux mentality doesn't seem to embrace that mindset. As a Linux sysadmin, I'm expected to know stuff. I expect other sysadmins to know stuff. That's just the way we are.
The OP asked 'why would I if I can accomplish the same thing with a GUI'. The answer frequently is that that sysadmins frequently do things that have a repetitive aspect to them, and one commandline can iterate as many times as you want. How many point-and-clicks can you do in the time it takes to iterate the same command a few thousand times? Another case: when you come to a forum such as LQ looking for help with a problem, most often the solution can be offered in terms of one or a few lines of some scripting code. You can then unambiguously copy & paste that into a shell or editor, and it will work. Conversely, using some GUI, one has to describe where to point and click, drag this here or there, menu that, and so on (and hope that the same arrangement of GUI things exists in the same form on the systems used by everyone who ever reads the reply).
Sysadmins usually have numerous servers to manage. It is easy to have one or two text-mode consoles for each of a dozen or two servers open on a single workstation desktop. Having GUIs and icons for a bunch of servers scattered all over a desktop is a recipe for confusion and errors.
GUI's may be good for paddling around figuring out how to to do some things once. Real efficiency is gained by using the computer to do what it does best: repeating. Linux/UNIX idiom includes the concept of 'small tools that do one thing well' and a system that enables their use in combination to solve larger problems. GUI's don't do a good job of enabling that.

--- rod.

Last edited by theNbomr; 10-07-2012 at 09:18 AM.
 
2 members found this post helpful.
Old 10-07-2012, 12:06 PM   #13
Maxuuma
LQ Newbie
 
Registered: Oct 2012
Distribution: CentOS 6.3
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by cascade9 View Post
Why would you want to launch every program/app with root privs?
Any program, not every program. It seems some apps that can control settings will only do so as root, and not all of them will prompt for the root password.

Quote:
Originally Posted by cascade9 View Post
If you think you need root privs all the time with nautilus, either you are doing something wrong or you are still stuck in a windows 'I always run as admin!' mindset.
I'm used to running Win7 and 2008. I'm happy with UAC. I'm not trying to avoid clicking Yes and typing in a password. I'm trying to keep things as efficient as possible and still have an acceptable level of security. What I'm learning now in linux is that there is a lot of needless interface complexity.

Quote:
Originally Posted by brianL View Post
You had to use dozens of keystrokes to type these posts to LQ, or did your mouse do it?
I'm hoping it will pay off in the coming months.

Quote:
Originally Posted by theNbomr View Post
Really, this is all just a lot of Windows-think being expressed here. The Windows mentality is that it is inefficient to have to think or learn things about the tool being used.
The Linux mentality doesn't seem to embrace that mindset. As a Linux sysadmin, I'm expected to know stuff. I expect other sysadmins to know stuff. That's just the way we are.
That's a blatant mischaracterization of what I've said. My goal is to get things done. I'm not in IT to learn things for the sake of learning things. I don't familiarize myself with multiple software products to be geekier-than-thou. Time is money. The less time I have to spend accomplishing one task, the more time I have available for accomplishing other tasks. I will learn what I need to learn to meet the goal. Can you explain what is superior about typing multiple lines to do what could be accomplished far more quickly in two clicks? Do you write an entire OS and all applications from scratch every time you need a server for something? Why wouldn't you, if you're "expected to know stuff?" Because it's comparatively inefficient, that's why. You wouldn't accomplish much if you had to do things that way. For the same reason, I'd rather use a gui than a cli when it results in getting more work done. When I use the cli, it isn't because typing every path, command, and switch makes me feel good about myself; it's because it's more efficient than using a gui. Or because a gui would be faster but hasn't been created yet.

Look at this website, for example. Did the LQ.com admins type the whole thing out in gedit? Did they even configure the settings with text commands and scripts? No. This forum software uses a gui installer, and it's mostly configured though a gui. Do you type a command and path for every page on the forum you want to visit? Do you script that? Why not... shouldn't you know how to do stuff? Shouldn't you know how to use the cli tell the forum backend to quote sections of another person's post? Shouldn't you know how to write a script that you run from the cli to take you to every sub-forum and section? No, that would be a waste of time, when you could instead replace those multiple lines of commands with one mouse click.

Quote:
Originally Posted by theNbomr View Post
The OP asked 'why would I if I can accomplish the same thing with a GUI'. The answer frequently is that that sysadmins frequently do things that have a repetitive aspect to them, and one commandline can iterate as many times as you want. How many point-and-clicks can you do in the time it takes to iterate the same command a few thousand times?
This isn't about long and repetitive tasks. I script things in Windows, too. But using a gui is very often quick enough that not everything warrants writing a script to do. And believe it or not, gui interactions can be scripted, too. So it's not an either-or situation.

Quote:
Originally Posted by theNbomr View Post
Another case: when you come to a forum such as LQ looking for help with a problem, most often the solution can be offered in terms of one or a few lines of some scripting code. You can then unambiguously copy & paste that into a shell or editor, and it will work.
If the app and distros are similar enough versions to what the reader is using. Otherwise, post a new thread, because there's no gui to guide you to the right action without spending a lot more time reading and less time getting things done.
And it's not as if there's no gui for many of these things I'm trying to do in linux. There is. It's there. I came here because I wanted to know if there was a good way to make use of it - to elevate it quickly. It was a simple question. I really don't mind the people who responded with solutions I explicitly ruled-out in my initial post. But I didn't ask for anyone to tell me how they think they know better than I do what a sysadmin's job is about.

Quote:
Originally Posted by Wim Sturkenboom View Post
The only way that I'm aware of is by logging in as root into the GUI.
Thank you for carefully reading my question and offering a straightforward answer.

I'm wondering if this is not as bad an idea as many make it out to be. It's not a desktop system, so it's not going to be used for surfing the web, downloading all sorts of sketchy applications pulled from p2p file sharing where malicious apps could run during my session. Could I "do something stupid" as root and mess everything up? Yes, but if I don't know any better, I'm going to do it regardless. Having to type "su" isn't going to stop me from doing something I shouldn't. If someone online says to do something that should resolve my issue, I'm going to do it, because right now I don't know one way or the other if I should. And when I start to think I have learned enough try things that haven't been told to me explicitly, I'm going to do it whether or not it's the correct thing to do. "Su" isn't going to prevent that. When it's time for this to be used on a production machine, hopefully I'll know better by then than to "do something stupid" (at least not without first trying it on a test machine).
 
Old 10-07-2012, 12:41 PM   #14
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,044

Rep: Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100
Quote:
Originally Posted by Maxuuma View Post
But why would I if I can accomplish the same thing with a GUI in a fraction of the time as it takes to type everything out (even if you never fat-finger it).
I agree with you 100% and Centos can be used the way you want (at least mostly).

You already hit the biggest problem in using Linux that way: The normally great resource of LQ can get drowned out by all the command line fanatics who tell you not to use GUI when you want to know how to use GUI.

Quote:
Some people may enjoy typing commands all day. I enjoy getting things done. If I can replace dozens of keystrokes with a couple mouse clicks, I'll get more done.
I don't really buy that argument, even though I agree 100% with the end point reached from that argument.

I doubt you would be any faster with a few mouse clicks than an experienced Linux expert who is also a good typist would be with the command line.

I prefer GUI because I need to be expert at far too many different things, each of which I might not touch for months then suddenly need to do again efficiently. I always remember the concepts and forget the names and the syntax and the option letters etc. A GUI can be very fast if you know the concepts and forgot the details. A command line is useless until you research the details.

Quote:
Originally Posted by cascade9 View Post
Why would you want to launch every program/app with root privs? If you are going to do that, you might as well login as root.
I did not get the impression that the OP wanted to launch every program with root privs. Quite the opposite! The ability to right click a menu item in the desktop menu system and select running that as root would give you the maximum opportunity to run as root only what you consciously decide to run as root and never run anything unintentionally as root. So far as I know, Linux desktops don't give you that ability.

When I am doing a lot of admin work in Linux, I prefer to keep two desktops running at once logged in differently, one as root and one as my ordinary identity. The root one is set up with a distracting background (vs. the plain blue I use normally) and is missing FireFox and in several other ways reminds me that it is not my normal desktop. On Linux I never read email as root. I never surf the net as root. I often want to read email and/or online info intermixed with GUI activities as root, which is why I do so with two separate desktops open.

Quote:
Originally Posted by theNbomr View Post
As a Linux sysadmin, I'm expected to know stuff. I expect other sysadmins to know stuff. That's just the way we are.
But some of us aren't that way. I am not primarily a Linux sysadmin. But even if I were, I apparently don't think the way you think.

Quote:
sysadmins frequently do things that have a repetitive aspect to them, and one commandline can iterate as many times as you want. How many point-and-clicks can you do in the time it takes to iterate the same command a few thousand times? Another case: when you come to a forum such as LQ looking for help with a problem, most often the solution can be offered in terms of one or a few lines of some scripting code.
Those are very important exceptions to ordinary activities. It is very important to know the command line method exists and not be terrified of it.
When I would need to do the same point and click enough times that it is worth researching the command line syntax to do the same job in bulk, I know that method exists and I know how to research it.
When someone answers in a forum with the command line method, I agree that is a better way to communicate the info, so whoever asked gets to take advantage of the fact that the expert answering memorized or looked up the syntax.
After all that, I still prefer GUI for ordinary tasks.

Quote:
Originally Posted by Maxuuma View Post
It's not a desktop system, so it's not going to be used for surfing the web
If you examine many severe security disasters, you find a sysadmin reading his email with root or admin privileges. So it isn't a risk to be ignored. It also is a manageable risk if you pay just a little attention to it.

The information you are using during a sysadmin activity very often is coming from an email or some online source. But as a sysadmin, you should be used to using multiple computers with multiple logical desktops all from one physical desktop.

When I had sysadmin rights at work (I don't anymore) the logical desktop running email/web access wouldn't ever have been even on the same computer as the one on which I was logged in as root (even though the logical desktops might be side by side on my multiple monitor workstation and accessed by the same keyboard/mouse). When I do such at home, it is on the same computer, but as I said above not logged in the same.

Last edited by johnsfine; 10-07-2012 at 01:14 PM.
 
1 members found this post helpful.
Old 10-07-2012, 12:46 PM   #15
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Rep: Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979Reputation: 3979
Since you refuse to learn the things I don't know if you know better when you go the production machines.

But anyways, since most Linux servers still don't run a GUI, but you insist on using a GUI I would recommend to go for a way in the middle and use a web-interface for your admin tasks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to allow access to some commands having root privleges to be run bu non root user suryashikha Linux - Newbie 8 10-31-2009 01:05 PM
How can I have a script owned as root and run as root by a user: setuid? stickey bit? abefroman Linux - Newbie 9 04-19-2008 05:15 PM
why lftp command run failed when user isn't root, but ok when logining as root steven_yu Linux - Software 0 06-06-2007 08:36 PM
Is a script, run at boot time from init.d, run with root authority? tmbrwolf53 Linux - Server 2 03-31-2007 08:15 PM
Convenient downloads of 4.1 aes12 Linux From Scratch 1 05-09-2003 11:09 PM


All times are GMT -5. The time now is 10:45 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration