You are not logged in.

#1 2016-11-01 15:57:42

Snake
New Member
Registered: 2016-11-01
Posts: 4

Help with root and polkit

Hello, im new on this distribution, its awesome and i did install it on a USB.

I want disable sudo access to my user but i want use polkit to gparted etc... but if i disable user in /etc/sudoers polkit asks me user password and not root password.

How can i configure that?

Thanks.


If you don't like the hand that fate's dealt you, fight for a new one.

Offline

#2 2016-11-01 19:08:28

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Help with root and polkit

Snake wrote:

if i disable user in /etc/sudoers

Please post the full content of /etc/sudoers

To disable `sudo` for your user, simply remove them from the "sudo" group:

# gpasswd -d $USER sudo

Run the command with root privileges and replace $USER with your actual username.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#3 2016-11-01 19:12:42

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Help with root and polkit

I am by no means a polkit expert, but I believe you'd also have to edit the policy files that polkit looks at. For example (as always guys, fact check me here)  I believe that in /usr/share/polkit-1/actions  you'll find actions that polkit monitors. (like your gparted example). You then have to edit that file to change rather you want the user or not to be allowed to perform it.  It's an XML style file iirc with a few different options like "yes"  "no"   "auth_self"  auth_admin"  etc....

I *think* that's what you're going to need to change and configure to get it working for you mate.


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#4 2016-11-01 19:13:58

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Help with root and polkit

Darnit, I was ninja'd.  Then HoaS, is most likely correct here.


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#5 2016-11-01 20:22:32

Snake
New Member
Registered: 2016-11-01
Posts: 4

Re: Help with root and polkit

Head_on_a_Stick wrote:
Snake wrote:

if i disable user in /etc/sudoers

Please post the full content of /etc/sudoers

To disable `sudo` for your user, simply remove them from the "sudo" group:

# gpasswd -d $USER sudo

Run the command with root privileges and replace $USER with your actual username.

Thanks for response.

My full /etc/sudoers is:

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
#root	ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
#%sudo	ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

I did comment a few things for disable sudo, i dont like sudo, i want use "su" command but when i launch an app graphically, like gparted into openbox menu, polkit ask me user password and not root password.

Last edited by Snake (2016-11-01 20:23:34)


If you don't like the hand that fate's dealt you, fight for a new one.

Offline

#6 2016-11-01 20:58:46

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Help with root and polkit

I don't have access to a GNU/Linux box at the moment but this documentation explains the location and syntax of the polkit configuration files:

https://www.freedesktop.org/software/po … kit.8.html

I will post back when I can offer more specific guidance.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#7 2016-11-01 21:15:21

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 643

Re: Help with root and polkit

@OP: if you don't like sudo, why not remove it, altogether?

BEWARE: proper way to remove sudo package should be:
1.

$ sudo passwd su   # set password for user 'root', which remains
                   # unset on 'sudo'-based BL setups like BL

2. As an ordinary user, execute

$ su             # 'login' yourself as a root, and simultaneously check
                 # that your 'root' user is accessible

3. Actually remove sudo package

$ sudo apt-get --purge remove sudo 

Now you can log in as a 'root' user, and do the stuff.

EDIT: changed advice, to make it more foolproof.

Last edited by iMBeCil (2016-11-01 21:28:30)


Postpone all your duties; if you die, you won't have to do them ..

Offline

#8 2016-11-01 21:16:29

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Help with root and polkit

Uhh isn't removing sudo a pretty big and glaring security 'no no' ?



I don't have access to a GNU/Linux box at the moment but this documentation explains the location and syntax of the polkit configuration files:

https://www.freedesktop.org/software/po … kit.8.html

I will post back when I can offer more specific guidance.

Sweet! My method would work according that link!

Last edited by Horizon_Brave (2016-11-01 21:23:20)


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#9 2016-11-01 21:22:57

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 643

Re: Help with root and polkit

^Hm ... I would say quite the opposite. But, properly configured sudo is probably as safe ...

But, you are probably referring to cases where non-skilled (and careless) user uses too much 'root' account (equivalent of logging in as the Administrator on MS Windows). Yes, in this case 'sudo' is probably better solution.

But, I was answering OP's question, and his desire to not to use 'sudo'. Give him some credit  smile


Postpone all your duties; if you die, you won't have to do them ..

Offline

#10 2016-11-02 11:54:37

Snake
New Member
Registered: 2016-11-01
Posts: 4

Re: Help with root and polkit

Thanks to all for response.

Finally i did disable sudo with "iMBeCil" method, i did want use polkit with root account, anyway with this is well.


If you don't like the hand that fate's dealt you, fight for a new one.

Offline

#11 2016-11-03 06:58:46

ohnonot
...again
Registered: 2015-09-29
Posts: 3,915
Website

Re: Help with root and polkit

Snake wrote:

I did comment a few things for disable sudo, i dont like sudo, i want use "su" command but when i launch an app graphically, like gparted into openbox menu, polkit ask me user password and not root password.

comment? you mean the sudoers file?
honestly i wouldn't do it.
i also wouldn't uninstall sudo.
removing user from sudo group should be totally sufficient for your demands!!!

about the graphical apps, i guess you are starting them from the menu, and that uses e.g. "pkexec-gparted" which i think will invoke the gksu dialog.
i know that gksu can be configured to use su instead of sudo!
try "gksu-properties".

Online

#12 2016-11-03 11:35:08

Snake
New Member
Registered: 2016-11-01
Posts: 4

Re: Help with root and polkit

ohnonot wrote:
Snake wrote:

I did comment a few things for disable sudo, i dont like sudo, i want use "su" command but when i launch an app graphically, like gparted into openbox menu, polkit ask me user password and not root password.

comment? you mean the sudoers file?
honestly i wouldn't do it.
i also wouldn't uninstall sudo.
removing user from sudo group should be totally sufficient for your demands!!!

about the graphical apps, i guess you are starting them from the menu, and that uses e.g. "pkexec-gparted" which i think will invoke the gksu dialog.
i know that gksu can be configured to use su instead of sudo!
try "gksu-properties".

Thanks you very much!!!

I has configure gksu-properties for use root account and i has delete user from sudo group, works fine now.


If you don't like the hand that fate's dealt you, fight for a new one.

Offline

#13 2016-11-07 04:33:14

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Help with root and polkit

So...I gotta ask, OP and to anyone really..What's the advantage of doing all of this? If you're just going to trade the idea of using sudo instead with gksu...what benefit does this provide?


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#14 2016-11-07 07:24:42

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 730

Re: Help with root and polkit

Horizon_Brave wrote:

So...I gotta ask, ...what benefit does this provide?

The ability to switch distros in a dual-boot setup without having to retrain yourself into different habits according to which wallpaper is showing, and not much else besides the learning experience.


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Offline

Board footer

Powered by FluxBB