LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-25-2020, 12:24 PM   #1
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Rep: Reputation: 103Reputation: 103
setuid is automatically removed from ping exe after copying


Any ideas why the setuid would be automatically removed when I copy ping to /root, for instance?
Is this documented anywhere? Is it standard or maybe distro-related?
Code:
root@testy:~# ls -l /bin/ping
-rwsr-xr-x 1 root root 64424 Jun 28  2019 /bin/ping
root@testy:~# cp /bin/ping /root
root@testy:~# ls -l /root/ping
-rwxr-xr-x 1 root root 64424 May 25 17:23 /root/ping
This is Ubuntu 18.04, which, weirdly enough, still uses setuid instead of capabilities for ping.
 
Old 05-25-2020, 01:11 PM   #2
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by vincix View Post
Is this documented anywhere? Is it standard or maybe distro-related?
It is cp related: look at the -p option
Normally cp doesn't preserve either mode, ownership nor timestamps

PS: in my system 'ping' doesn't have have READ access either for others than root, so it's -rws--x--x

Last edited by ehartman; 05-25-2020 at 01:14 PM. Reason: added PS
 
1 members found this post helpful.
Old 05-25-2020, 01:26 PM   #3
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
What are you using? Slackware?
I see this is how it is in Centos 7. But Centos 7 uses capabilities, instead of setuid. And I guess the read permissions are useless, nonetheless.
Code:
[root@domain ~]# ls -l /bin/ping
-rwxr-xr-x 1 root root 66176 Aug  4  2017 /bin/ping
[root@domain ~]# getcap /bin/ping
/bin/ping = cap_net_admin,cap_net_raw+p
But yeah, good point about cp, didn't think of that in this context, although I've come across the problem when I really needed to preserve permissions
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I cannot ping with command 'ping IP' address but can ping with 'ping IP -I eth0' sanketmlad Linux - Networking 2 07-15-2011 05:32 AM
cygwin g++-3.exe, gcc-3.exe corrupted to g++3.exe.dam and gcc-3.exe.dam pawanjanbandhu Linux - Newbie 2 12-03-2009 11:27 AM
cygwin g++-3.exe, gcc-3.exe corrupted to g++3.exe.dam and gcc-3.exe.dam pawanjanbandhu Linux - Software 1 11-17-2009 02:26 PM
Removed accidently removed panel at Suse 11.1? alte_mann SUSE / openSUSE 6 01-29-2009 04:19 AM
samba compatibility with microsoft srvtools.exe (usrmgr.exe and srvmgr.exe) checkmate3001 Linux - Software 1 09-06-2008 05:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration