Active Topics

 


Reply
Thread Tools
Posts: 385 | Thanked: 426 times | Joined on Dec 2009 @ Gothenburg, Sweden
#1
Hi all,

Is it just me that miss the abillity to ping as any user?
Well, I guess the way to fix it would be to add it to the /etc/sudoers ? I know this is something that should be done with great care though, messing up the sudoers is not the best experience one can have.

However, as root I added the following line to /etc/sudoers:
Code:
user ALL = NOPASSWD: /bin/ping
and then I issued:
Code:
update-sudoers
That didn't work, 'user' still has no right to ping, so what am I doing wrong? Is it so that dependant processes to ping must also be added to sudoers?
Sorry, if this is a stupid question or has already been resolved somewhere (couldn't find it after searching though).

EDIT: I am aware that I should add a script to sudoers.d instead. But first I wanted to try this in sudoers.

Last edited by Larswad; 2010-11-23 at 11:52.
 
JonWW's Avatar
Posts: 623 | Thanked: 289 times | Joined on Jan 2010 @ UK
#2
Probably
Code:
sudo ping IPAddress
 
Posts: 385 | Thanked: 426 times | Joined on Dec 2009 @ Gothenburg, Sweden
#3
@JonWW: Thanks, but that's also another interesting thing, 'sudo' has never really worked for anything, even if I have set a password for root.
I always has to go root first using either 'root' or 'sudo gainroot', but nothing else works using 'sudo'.

Does 'sudo' work for you?
 
Posts: 237 | Thanked: 193 times | Joined on Feb 2010 @ Brighton, UK
#4
Just tried this out and:

sudo ping www.google.co.uk

worked perfectly for me from user shell.

You will get a complaint if you issue this from a root shell prompt of course - only sudo as user. Make sure you 'exit' after running update-sudoers back to user.
 

The Following 2 Users Say Thank You to mr id For This Useful Post:
JonWW's Avatar
Posts: 623 | Thanked: 289 times | Joined on Jan 2010 @ UK
#5
What you described in setting up ping for sudoers with no password is how 'gainroot' and 'kernel-config', to name 2, are setup and you run them first with the prefix 'sudo' and it asks for no password. Compare how they are setup to what you are doing.
 

The Following User Says Thank You to JonWW For This Useful Post:
Posts: 385 | Thanked: 426 times | Joined on Dec 2009 @ Gothenburg, Sweden
#6
@mr id: Thanks, using sudo in 'user' context DID work also for me, but only after I had added that line to the sudoers.
(BTW, I never used sudo while being root, just to be clear...That much I know).
But still, here's my current confusion:
1. I had expected that adding ping to sudoers (with 'ALL' as users), would mean I could issue the ping command as user, even without prefixing with sudo. What would I have to do to be able to do that? EDIT: I will check and compare with kernel-config like suggested above.
2. Even so, being able to issue 'ping' while BEING root, but not being able to issue 'ping' as 'user' with sudo (without adding ping to sudoers), what is the actual difference? sudo MEAN superuser do, and that would mean I am super user while issuing sudo right? So why do I explicitly have to add ping to sudoers to be able to issue 'sudo ping' from user context?

What am I missing in the logics here?

Last edited by Larswad; 2010-11-23 at 12:23.
 
JonWW's Avatar
Posts: 623 | Thanked: 289 times | Joined on Jan 2010 @ UK
#7
Ping is a root command and has to run as root so prefixing with sudo alows a user to run the command without being root or needing to know the root password.
 
Posts: 2,802 | Thanked: 4,491 times | Joined on Nov 2007
#8
Originally Posted by Larswad View Post
I know this is something that should be done with great care though, messing up the sudoers is not the best experience one can have.
Exactly. Never do this manually, use visudo instead.
 
Posts: 385 | Thanked: 426 times | Joined on Dec 2009 @ Gothenburg, Sweden
#9
@JonWW: Yes indeed ping is a command that require root privileges But in the end, isn't this just a matter of permissions (privileges) and that's the whole idea about the sudoers: Who has the right to do what.
And besides, issuing sudo as user DOES prompt me for password, in difference to doing 'sudo gainroot' or 'root', so it doesn't really add up what you say. Take ubuntu for instance, where you by default never can login as root (as a security measure), so then users mostly work with privileged commands using sudo or for more lengthy operations sudo -i
But there you are ABLE to use ping as any user in the users group (without using sudo).
And I figured that just works like that because they have added ping to sudoers, am I right?

So, I'm back to where I started, I just don't understand how to do this.

@Ima: Thanks, I knew that in the back of my head but I forgot!

Last edited by Larswad; 2010-11-23 at 13:08.
 
MohammadAG's Avatar
Posts: 2,473 | Thanked: 12,265 times | Joined on Oct 2009 @ Jerusalem, PS/IL
#10
I thought visudo should never be used on maemo...
 

The Following User Says Thank You to MohammadAG For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 05:48.