How does sudo work?

Questions about applications and software
Forum rules
Before you post please read this

How does sudo work?

Postby Voom on Fri Apr 20, 2012 1:32 am

I come from a background of distros that use root and not sudo by default. I am new to it and I have perhaps a simple question about sudo. Where are all the permissions? I understand setting up /etc/sudoers and groups, but then there is the users-admin gui. What, where are these settings? A user is not in the group sudo only adm, yet /etc/sudoers is set to allow the sudo group, nothing about adm. Is there another config about sudo elsewhere? Because I have the behavior that I want already, root password for sudo on everything and only allowed through one user. but I'm just confused about this and want to make a note of how this works. Does it all default to gksu automatically? If so, why is it still reading config from sudoers? I have this line and it's being honored:

%sudo hostname=(ALL)NOPASSSWD:/usr/bin/mintupdate

No prompt for mintupdate, but user not in sudo group, either. What's going on?
Voom
Level 1
Level 1
 
Posts: 8
Joined: Sun Apr 15, 2012 9:46 am

Linux Mint is funded by ads and donations.
 

Re: How does sudo work?

Postby xenopeek on Fri Apr 20, 2012 6:57 am

I'm not sure I understand it either, but I know for sure mintupdate is not the right example to try and figure this out with. Why? Well, do a:
Code: Select all
cat /usr/bin/mintupdate

Then a:
Code: Select all
cat /usr/lib/linuxmint/common/mint-which-launcher.py

As you can see, the mintupdate script calls the mint-which-launcher.py script, and the final mintUpdate.py is actually started with gksu by these two scripts. Now I'm again not sure why this would work if your user doesn't have sudo group membership, but perhaps first try your sudoers line with a command that is a binary file and not a script that launches gksu itself...
Forum Rules | IRC Rules
Image
Linux Mint 14 Nadia / 64-bit / Cinnamon
User avatar
xenopeek
Level 20
Level 20
 
Posts: 10881
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: How does sudo work?

Postby Voom on Fri Apr 20, 2012 8:45 pm

You're right, it shouldn't work, and it doesn't. But sudo is using the root password, but the password was only being saved once input once into mintupdate. It won't work if the user is not in the sudo group. I'm still curious what the permission settings in users-admin are setting when you select Administrator or Desktop user, if anything.
Voom
Level 1
Level 1
 
Posts: 8
Joined: Sun Apr 15, 2012 9:46 am

Re: How does sudo work?

Postby xenopeek on Sat Apr 21, 2012 3:40 am

You can check that with:
Code: Select all
grep username /etc/group

Replace username with the user in question, and you will get a list of group memberships.

On my system, I'm not member of the sudo group. I'm member the of the admin group, and /etc/sudoers has this line for it:
Code: Select all
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
Forum Rules | IRC Rules
Image
Linux Mint 14 Nadia / 64-bit / Cinnamon
User avatar
xenopeek
Level 20
Level 20
 
Posts: 10881
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: How does sudo work?

Postby Voom on Sat Apr 21, 2012 1:15 pm

Well that's very strange. Which install are you using? I've installed the 2012 rc and there was no admin group, only adm and sudoers is configured as %sudo ALL=(ALL) ALL

Also, I haven't double checked but it seems that if a user is not a member of the group 'users', one can't reboot or shutdown without password (from xfce), but the new user setup doesn't set this. I guess this is to be expected from a RC? It seems to be working fine now but I had to configure all this manually. Now I just hope an update doesn't scramble these and make a mess.
Voom
Level 1
Level 1
 
Posts: 8
Joined: Sun Apr 15, 2012 9:46 am

Re: How does sudo work?

Postby xenopeek on Sat Apr 21, 2012 2:11 pm

Doh! Mixed up my distros, was looking at Linux Mint Main Edition, not LMDE... Apologies.
Forum Rules | IRC Rules
Image
Linux Mint 14 Nadia / 64-bit / Cinnamon
User avatar
xenopeek
Level 20
Level 20
 
Posts: 10881
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: How does sudo work?

Postby Voom on Sun Apr 22, 2012 9:09 pm

It happens. I was wrong about the users group comment. That's not why it happens. It just seems to happen randomly sometimes. I guess it's a bug.
Voom
Level 1
Level 1
 
Posts: 8
Joined: Sun Apr 15, 2012 9:46 am

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: No registered users and 2 guests