Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Cannot run `ip` command without `sudo` as root
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
copapa
n00b
n00b


Joined: 14 Nov 2014
Posts: 7

PostPosted: Fri Jul 31, 2015 9:39 am    Post subject: Cannot run `ip` command without `sudo` as root Reply with quote

Hi.

I am having a problem with the ip command. I can run it normally as a simple user but cannot run it (i.e. no output appears, not even usage, but return code is 0) as root except if I use sudo (return code is 0 despite lack of output).
Selinux permissive or enforcing mode does not change this behavior.

Here is dump of a session : http://pastebin.com/index/VfVkFC7t .

Any clue ?
Back to top
View user's profile Send private message
copapa
n00b
n00b


Joined: 14 Nov 2014
Posts: 7

PostPosted: Fri Jul 31, 2015 9:45 am    Post subject: Reply with quote

Ok just after posting I had the idea to check if `ip` and `sudo ip` ran the same binary. And there I find

Code:
hostname ~ # which ip
/sbin/ip
hostname ~ # sudo which ip
/bin/ip
hostname ~ # ls -l /bin/ip
-rwxr-xr-x. 1 root root 318432 Jan 14  2015 /bin/ip
hostname ~ # ls -l /sbin/ip
-rwxr-xr-x. 1 root root 0 Apr  1 11:35 /sbin/ip


Ok something is really weird. I have a 0 byte `/sbin/ip`. And I wondered why my script didn't work :(
Anyone has an idea of the origin of this file ?
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Fri Jul 31, 2015 12:03 pm    Post subject: Reply with quote

copapa wrote:
Anyone has an idea of the origin of this file ?

$ equery b /sbin/ip
Back to top
View user's profile Send private message
copapa
n00b
n00b


Joined: 14 Nov 2014
Posts: 7

PostPosted: Fri Jul 31, 2015 12:51 pm    Post subject: Reply with quote

Found the culprit !

My colleague created this file long time ago to silence an error message from FirewallBuilder (this program uses /sbin/ip as the default path for the ip command) but the ip command was just used to do some non-essentials checks in the script.

Sorry for the noise.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum