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 12-31-2007, 03:04 PM   #1
Rustylinux
Member
 
Registered: Mar 2006
Posts: 177

Rep: Reputation: 30
How to use sudo access in GUI


Hello,

I was wondering if someone could inform me on how you would go about using sudo in Gnome and KDE. I usally use the terminal personally but I had a friend that is new to linux asking me a bunch of questions and I couldn't answer that one for him, needless to say he didn't like my "just use the terminal answer"

So how does one do this in Gnome and or KDE. He is currently using Gnome with Nautilus, however I'm sure the time will come when he messes around with KDE as well.

Thanks!
 
Old 12-31-2007, 03:11 PM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
kdesu for Kde and gksudo for Gnome - as in "kdesu <program name>" or "gksudo <program name>". The Kde command requires the root password though.

https://launchpad.net/kdesudo will be a KDE frontend for sudo once complete.
 
Old 12-31-2007, 03:19 PM   #3
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Having root access just like that would beat the purpose of sudo. It would be dumbing down Linux to what windows is in the hands of most people: a system where pretty much anything goes. But if that is the only option, one may as well pick a system that allows one to log in as root and work under the root account all the time. No good but, well, I'm sure you already know that. The alternative is modifying one's menu entries in such a way that you a message box popping up to request the root password first. That would be equivalent to the sort of behaviour that one sees when one selects a task from the menu that requires root permissions (say, the Firewall menu item). I haven't seen any need for this but I imagine it could be achieved relatively easily using gksu or gksudo.

Last edited by jay73; 12-31-2007 at 03:21 PM.
 
Old 01-02-2008, 08:58 AM   #4
Rustylinux
Member
 
Registered: Mar 2006
Posts: 177

Original Poster
Rep: Reputation: 30
Hello,

I guess what I'm trying to ask is, i don't want to run as root I just want to know how you would do a sudo in the GUI much like if I where in the terminal trying to copy some files around and it said permission denied I would sudo my cp and away I go. How would you do something like this in the GUI.

For instance, lets say I want to copy a file from my desktop into a folder somewhere in my directory structure and it gives me a access denined. How would you accomplish the same effect as doing a sudo in the terminal execpt in the Gnome GUI without logging in as root ?
 
Old 01-02-2008, 12:53 PM   #5
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
In that case, you could install a file manager (something like midnight commander, for example) and then edit the menu entry: if that entry has "gksudo command" instead of simply "command", it will pop up an authorization box before launching the application. Once you have submitted proper authorization, the file manager will give you all the access that you would get from sudo in a CLI.
 
Old 01-02-2008, 02:52 PM   #6
Rustylinux
Member
 
Registered: Mar 2006
Posts: 177

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by jay73 View Post
In that case, you could install a file manager (something like midnight commander, for example) and then edit the menu entry: if that entry has "gksudo command" instead of simply "command", it will pop up an authorization box before launching the application. Once you have submitted proper authorization, the file manager will give you all the access that you would get from sudo in a CLI.
Ahhh thanks for the info, I will have to give this a try. Do you know if Gnomes File Manager by default has such abilities built in. As i know Gnome by default loads gksudo and u can run that from the teraminal but you can't right click on a file and run it, or run it from the menu systems.
 
Old 01-02-2008, 03:03 PM   #7
hand of fate
Member
 
Registered: Nov 2003
Distribution: Mandriva
Posts: 441

Rep: Reputation: 31
Quote:
Originally Posted by jay73 View Post
In that case, you could install a file manager (something like midnight commander, for example)...
Why would you need to install a file manager? Both KDE and Gnome include a file manager, so anyone running one of those systems will already have one.

What I do is enter "konqueror" in the KDE Run Command panel, check "Run as a different user", and enter "root" and my root password in the respective boxes. If you need to do this repeatedly then you could create a menu item that runs your file manager of choice as root (in fact some distributions have such a menu item by default).
 
Old 01-02-2008, 03:24 PM   #8
MoonMind
Member
 
Registered: May 2005
Location: Switzerland
Distribution: Ubuntu
Posts: 448

Rep: Reputation: 38
Rustylinux:

You can change any menu item to read gksudo [application] (or kdesudo ...) instead of [application]; if you configure the /etc/sudoers file in the right way (it probably is already), the confirmation box mentionned above pops up. But I think it'd be important to explain to the guy in question that he should limit himself to the system administration tasks he's meant to use until he's got a little experience - as soon as he's root (or doing things as if he were root) and goes trying out stuff, he can - and probably will - mess up things; of course, this can be desired for pedagogical purposes... Just make sure your not the guy who has to fix things in that case, then Anyway, if he's becoming aware of the fact that not being root is a win in many cases (security-wise) he can be taught what is necessary in due time. That may sound conservative and patronising, but from supporting distributions that didn't erect that extra barrier I know what harm can come from careless usage of root privileges (and I know many who'd agree).

However, if he's really put off by the need to enter a password, you can change the /etc/sudoers file accordingly. I normally wouldn't, but I have used (and supported) systems that are configured that way because a lot of new users (coming from WinDoze) expect it to be that way. If they're sensible enough about it (and are used to locking their terminal when they leave it), it's not too bad, but still a security risk. All in all, the better behaved (experienced?) a user is, the less will she/he feel the need to become root on a daily basis (if she/he's not a sysadmin, but that's a completely different story).

hand_of_fate:

I think that precisely this simple approach is perceived as "complicated" by many WinDoze users... I always have an xterm open for all purposes, and it's great for just about everything, but I know for a fact how intimidating this is for people who're not used to the CLI. Heck, it literally keeps certain people off my box altogether

M.

Last edited by MoonMind; 01-02-2008 at 03:28 PM.
 
Old 01-02-2008, 03:38 PM   #9
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Quote:
Why would you need to install a file manager?
Yes, of course, KDE and Gnome already have file manager. Now, I don't know about KDE but the Gnome run command box (Alt + F2) does not have an option to specify the user to run as. So you are down to two options: either you modify the permissions on your file manager but then you run with root permissions all the time - not very secure - or you install an alternative file manager that you only use when you have a need to. But now that I think about it, I am sure that it would be possible to add a menu item for an "enhanced" nautilus that is launched from the menu (command: gksudo nautilus). This would give you a second nautilus that, unlike the default one, allows you to do about anything. I just tested this on my Fedora box from the command line and it appears to work fine. In order to make it work from the menu, you just create a new menu entry, name it "root file manager" or something like that and you specify the command as "gksudo nautilus".

Last edited by jay73; 01-02-2008 at 03:42 PM.
 
Old 01-02-2008, 04:12 PM   #10
hand of fate
Member
 
Registered: Nov 2003
Distribution: Mandriva
Posts: 441

Rep: Reputation: 31
Quote:
Originally Posted by jay73 View Post
Yes, of course, KDE and Gnome already have file manager. Now, I don't know about KDE but the Gnome run command box (Alt + F2) does not have an option to specify the user to run as.
The KDE one certainly does. I don't use Gnome, but even if it doesn't have that option you could still enter "gksu nautilus" or "gksudo nautilus" into it.

Quote:
Originally Posted by jay73 View Post
either you modify the permissions on your file manager but then you run with root permissions all the time
It's nothing to do with the permissions of the file manager. The issue is whether the permission of the files to be modified allow the user that the file manager is being run as to modify those files.

Quote:
Originally Posted by jay73 View Post
or you install an alternative file manager that you only use when you have a need to.
Any program (including any file manager that is already installed) can be run as any user that has permission to run it. Root by definition has permission to run any executable program. Why does the file manager you run with root permissions have to be different to the one you run without?

Quote:
Originally Posted by jay73 View Post
But now that I think about it, I am sure that it would be possible to add a menu item for an "enhanced" nautilus that is launched from the menu (command: gksudo nautilus).
It's not really an "enhanced" program. It's the same program as "regular nautilus", just running as a different user.

Last edited by hand of fate; 01-02-2008 at 04:14 PM.
 
Old 01-02-2008, 04:23 PM   #11
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Quote:
The KDE one certainly does. I don't use Gnome, but even if it doesn't have that option you could still enter "gksu nautilus" or "gksudo nautilus" into it.
Quote:
Why does the file manager you run with root permissions have to be different to the one you run without?
I'm afraid that you don't seem to get the point. The idea is that we need to start our file manager without any CLI commands. That is not what we do when we start the file manager from the command line or from a run command box. And if we start nautilus from the menu, we can't have it behave one way this time and another way the next time. We do need separate entries.

Quote:
It's not really an "enhanced" program. It's the same program as "regular nautilus", just running as a different user.
Yeah, true, but I thought the quotation marks made it clear that "enhanced" shouldn't be taken literally.

Quote:
It's nothing to do with the permissions of the file manager
Bad phrasing on my part. I was referring to using (gk)sudo to launch the file manager, which is something else. But of course, you are right.

Last edited by jay73; 01-02-2008 at 04:36 PM.
 
Old 01-02-2008, 05:51 PM   #12
hand of fate
Member
 
Registered: Nov 2003
Distribution: Mandriva
Posts: 441

Rep: Reputation: 31
Quote:
Originally Posted by jay73 View Post
I'm afraid that you don't seem to get the point.
What "point" may that be. The "point" that you "need" to install another file manager even though the one you've already got is perfectly capable of doing what you need? Since this statement is completely untrue, it is not a valid point.


Quote:
Originally Posted by jay73 View Post
The idea is that we need to start our file manager without any CLI commands.
If you create a menu item or icon to run the file manager as with root permission, you can then use that menu item or icon "without using any CLI" (in so far as you can do anything without using any CLI. What exactly does clicking on an icon do if it doesn't invoke a command behind the scenes?)

Quote:
Originally Posted by jay73 View Post
And if we start nautilus from the menu, we can't have it behave one way this time and another way the next time. We do need separate entries.
You only need separate menu entries, not a completely separate program. I don't know where you got the idea that you can't have menu items for same program with and without "gksudo" in front of it, but it's definitely not true. It's entierly possible (for example) to have one item for "nautillus" and another for "gksudo nautilus".

Quote:
Originally Posted by jay73 View Post
Bad phrasing on my part. I was referring to using (gk)sudo to launch the file manager, which is something else. But of course, you are right.
Why do you think that the only options are to always launch the file manager using (gk)sudo or use a completely different program when you need sudo? A far more obvious solution is to run the file manager of your choice with sudo when you need it, and the same program without sudo when you don't.
 
Old 01-02-2008, 08:39 PM   #13
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Sigh, this is going to be a great year. You know you are the second one in two days to misrepresent what I wrote only to make an argument out of it? A lot of people appear to be very,very bored these days. Here is what I wrote only a few posts ago:

Quote:
But now that I think about it, I am sure that it would be possible to add a menu item for an "enhanced" nautilus that is launched from the menu (command: gksudo nautilus). This would give you a second nautilus that, unlike the default one, allows you to do about anything.
But apparently you thought it was more important to fuss over the word "enhanced" than to look past it at what was really meant. And just in case, here is something else I wrote:

Quote:
I thought the quotation marks made it clear that "enhanced" shouldn't be taken literally.
I don't know if you read a lot but if you do, you should know that this is one of the things that quotation marks communicate. And don't start harping on the word "second" because that is what it is, you can perfectly have multiple instances of a single program running simultaneously.

Quote:
A far more obvious solution is to run the file manager of your choice with sudo when you need it, and the same program without sudo when you don't.
So what do you think I have been suggesting?? Only you seem bent on doing the first from the CLI while I was simply suggesting a solution that wouldn't force the user to do so.

So what is next? Are you going to object that the menu is, in fact, only a front-end to the terminal???

Last edited by jay73; 01-02-2008 at 08:45 PM.
 
Old 01-03-2008, 02:06 AM   #14
rikxik
Member
 
Registered: Dec 2007
Posts: 88

Rep: Reputation: 19
Oh man - the poor guy just needs to do gui operations in privileged mode.

@RustyLinux

Basically, your friend needs an icon/launcher/menu entry (you get the idea) on which he can click and launch Nautilus (since you mentioned he is using Gnome, Nautilus is the default file manager). So just get him to do this:
--
1. Right-click on the desktop
2. Choose "create launcher" (I may be missing the exact term). This will basically create a shortcut.
3. A dialog box pops up with fields to enter the name of the shortcut, the description and the command to be executed when this is double-clicked
4. Enter "sudo nautilus" (without double quotes) in the command field. Enter whatever you like in the name, description section.
5. Thats it - click ok and you have an icon on your desktop - you double click on it to launch nautilus which will run in privileged mode.
--
Just ask him to use it sparingly.

HTH

Last edited by rikxik; 01-03-2008 at 02:11 AM. Reason: Stupid broswer freeze
 
Old 01-03-2008, 09:42 AM   #15
hand of fate
Member
 
Registered: Nov 2003
Distribution: Mandriva
Posts: 441

Rep: Reputation: 31
Quote:
Originally Posted by jay73 View Post
So what do you think I have been suggesting??
I "think", in fact I know (the proof is right here in this thread) that you have been suggesting that the user installs an extra file manager that they don't need.

Quote:
Originally Posted by jay73 View Post
Only you seem bent on doing the first from the CLI
First of all, I am in no way "bent on" anything. I stated what solution I use (the "Run Command" panel), which I have every right to do. I also suggested another solution (adding menu item).

Secondly, at no point did I even make any mention of using the CLI.

Quote:
Originally Posted by jay73 View Post
while I was simply suggesting a solution that wouldn't force the user to do so.
You suggested for no explicable reason that the user installs an additional file manager that they do not need. I correctly pointed out that this is not necessary.

I am doing a service to anyone reading this thread by saving them the effort of installing an extra file manager for no reason. Some credit for this service would be appreciated, and would certainly be more appropriate than your constant argument.
 
  


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
ifconfig command access for sudo vbseeker Linux - General 5 08-12-2011 01:23 AM
how to provide sudo access mokku Linux - Newbie 1 09-12-2007 02:09 PM
Please help. Sudo access problem gneeot Ubuntu 5 11-17-2006 11:51 AM
Blocking access on a particular app (via sudo) Harlin Linux - Security 10 10-22-2006 02:11 PM
Sudo access to particular directories angrybeaver Linux - Software 0 09-23-2004 01:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:29 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration