How to change run as root prompt to sudo?

Discussion in general that pertains to Sabayon Linux - Must Pertain to Sabayon Linux

Moderator: Moderators

How to change run as root prompt to sudo?

Postby jc61990 » Mon Oct 22, 2012 2:56

Hello everyone, just made my switch from Arch to Sabayon X and so far i love sabayon. Any way i was trying to change the run as root prompt screen to ask for sudo password instead. This screen :
Image

i tried "sudo gksu-properties" then changed that from su to sudo. after rebooting i tried to change a setting and the run as prompt still asked for my root password.

is there any way to make this ask for sudo password instead?
jc61990
Baby Hen
 
Posts: 3
Joined: Wed Oct 17, 2012 18:26
Location: New York

Re: How to change run as root prompt to sudo?

Postby jc61990 » Fri Oct 26, 2012 15:38

Seriously? No one knows how to change this?
jc61990
Baby Hen
 
Posts: 3
Joined: Wed Oct 17, 2012 18:26
Location: New York

Re: How to change run as root prompt to sudo?

Postby cmost » Fri Oct 26, 2012 16:57

Well, first off, you haven't really explained what you want adequately, which might explain the lack of response.

Just shooting in the dark, have you tried adding your username to the sudoers file? I like to use sudo myself (because I'm used to it) and all I did was use nano (as root) to edit the sudoers file to look like this:


Code: Select all
root# nano /etc/sudoers


Then, scroll down until you see the entry:

Code: Select all
root ALL=(ALL) ALL


Now, simply add YOUR username such that it looks like this (note: where "user" is your username)

Code: Select all
user ALL=(ALL) ALL


Then, type CTRL+X and "Y" to save the file. You should be all set!
AMD Phenom II 64 X6 1090T Black Edition
8192 MB DDR2 RAM
nVidia GeForce GTX 660 w 2048 MB DDR5
Sabayon 2014.x 64 Bit KDE
"Better to remain silent and be thought a fool than to speak out and remove all doubt." -- Abraham Lincoln
cmost
Advanced Hen
 
Posts: 208
Joined: Wed Dec 13, 2006 22:25
Location: Cincinnati, OH

Re: How to change run as root prompt to sudo?

Postby jc61990 » Sat Oct 27, 2012 2:39

cmost wrote:Well, first off, you haven't really explained what you want adequately, which might explain the lack of response.

Okay, so for example, lets say i open Rigo, find a program i want and when i go to install, i am prompted with this very same screen asking for my root password. i would rather enter my user password which has sudo privileges, than my root password. also if i were to have a multi user system, i would rather the users not know the root password and just stick to sudo.

Just shooting in the dark, have you tried adding your username to the sudoers file? I like to use sudo myself (because I'm used to it) and all I did was use nano (as root) to edit the sudoers file to look like this:


thats the first thing i do on every linux install. depending on how the sudoers file is setup on install i will either add my self "myusername ALL=(ALL) NOPASSWD: ALL" or i will add myself to the wheel or adm group, which ever the distro uses. in this case i have manually entered my username into the sudoers file, sudo works as it should.

its not really a matter of having sudo or not, i would just like to be prompted for a user password instead of the root password
jc61990
Baby Hen
 
Posts: 3
Joined: Wed Oct 17, 2012 18:26
Location: New York

Re: How to change run as root prompt to sudo?

Postby cmost » Sat Oct 27, 2012 16:48

Ah, now I understand. The reason that Rigo (which I don't use btw, I think it's bloody awful; Sulfur was and still is much better) asks for the root (or Administrator) password is because only root can modify the system. While you've given your user account the ability to run root commands by prefacing the command with sudo, root is still executing the command while sudo still uses your user's path. My solution to this was simply to use the same password for both my username and root's. Crude, but effective.
AMD Phenom II 64 X6 1090T Black Edition
8192 MB DDR2 RAM
nVidia GeForce GTX 660 w 2048 MB DDR5
Sabayon 2014.x 64 Bit KDE
"Better to remain silent and be thought a fool than to speak out and remove all doubt." -- Abraham Lincoln
cmost
Advanced Hen
 
Posts: 208
Joined: Wed Dec 13, 2006 22:25
Location: Cincinnati, OH

Re: How to change run as root prompt to sudo?

Postby Stupot » Mon Oct 29, 2012 15:33

cmost, that is certainly not an option for a multiuser system.

I don't happen to have a solution for what you are asking for jc61990, but it makes perfect sense and I understand why you are asking for it. Unfortunately, you'll find most people here will simply tell you to use su instead of sudo for various reasons, some of them legit.

Also, I'm not sure if it you are prompted to run it as root because of a system setting or if the application specifies that it needs to be root and not just raised priviledges. If it is the former, then a code change will be in order, although I am doubting that is the case.
Stupot
Sagely Hen
 
Posts: 1545
Joined: Wed Feb 14, 2007 3:44
Location: St. Louis, MO, USA

Re: How to change run as root prompt to sudo?

Postby cmost » Sat Nov 17, 2012 20:06

cmost, that is certainly not an option for a multiuser system.


It is if only one user of the multi-user system is the Administrator, which I would certainly recommend be the case. Obviously I'm speaking of a shared home or small business computer not a server in a data center.
AMD Phenom II 64 X6 1090T Black Edition
8192 MB DDR2 RAM
nVidia GeForce GTX 660 w 2048 MB DDR5
Sabayon 2014.x 64 Bit KDE
"Better to remain silent and be thought a fool than to speak out and remove all doubt." -- Abraham Lincoln
cmost
Advanced Hen
 
Posts: 208
Joined: Wed Dec 13, 2006 22:25
Location: Cincinnati, OH

Re: How to change run as root prompt to sudo?

Postby Fitzcarraldo » Sun Nov 18, 2012 0:26

Just out of interest, in KDE I believe it is possible to achieve what jc61990 is asking (see e.g. this blog comment), but I don't use GNOME so don't know if there is a similar configuration file in GNOME.

EDIT: Does the command gksu-properties work in GNOME 3? If it does, try the following instruction from an Ubuntu 'question' (Question #171990):

Eliah Kagan wrote:Press Alt+F2, type in gksu-properties, press enter, and make sure that "Authentication mode" is set to sudo rather than su.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7981
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: How to change run as root prompt to sudo?

Postby albfneto » Sun Nov 18, 2012 15:04

in my regular, routine installations of Sabayon, i do not edit sudoers or change anything
I ever use the default options.

default options are:

for COMMANDS:

su uses Root Password
sudo uses User Password

for GRAPHICAL APPLICATIONS, GUIS:

kdesu (in KDE and gksu in other graphical env.) uses Root Password
kdesudo (or gksudo) uses User password
ALBERTO FEDERMAN NETO
albfneto
[email protected]
Favorite Distros: Sabayon, Gentoo, Mageia and OpenSUSE
User avatar
albfneto
Sagely Hen
 
Posts: 1711
Joined: Fri Nov 16, 2007 1:15
Location: Ribeirão Preto City, São Paulo State, Brazil

Re: How to change run as root prompt to sudo?

Postby creh » Mon Nov 19, 2012 17:23

You can change it for certain actions with polkit. The command pkaction (as root) returns a list of actions.
You can either change the defaults in the policy file (eg. /usr/share/polkit-1/actions/org.sabayon.RigoDaemon.policy for Rigo) for the action org.sabayon.RigoDaemon.manage from
Code: Select all
<allow_active>auth_admin_keep</allow_active>

to
Code: Select all
<allow_active>auth_self_keep</allow_active>

This way any user will be able to install/remove applications with his password. But I'm not sure if this method will survive an update.

Or you can create a rules file (must end in .rules) in /etc/polkit-1/rules.d/ (or in /usr/share/polkit-1/rules.d/).
You can use
Code: Select all
polkit.addRule(function(action, subject) {
    if (action.id == "org.sabayon.RigoDaemon.manage" && subject.user == "username")
        return "auth_self_keep";
    }
});

This will allow the user username to use his password. If you don't want to type your password at all, you can replace "auth_self_keep" with "yes".

If you allways want to be ask for your user password you could try to make a rule like
Code: Select all
polkit.addRule(function(action, subject) {
    if (subject.user == "username")
        return "auth_self_keep";
    }
});
creh
Young Hen
 
Posts: 25
Joined: Mon Nov 19, 2012 17:03
Location: Vienna, Austria


Return to Sabayon Linux General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests