How to solve error “ping: socket: Operation not permitted” when a non-root user executes ping command

Check where the ping command is:
which ping

And on my screen, the output is:
/bin/ping

Then check permissions on this command:
ls -l /bin/ping

And I see the below output:
-rwxr-xr-x 1 root root 72776 Jan 30 2020 /bin/ping

And I execute the below command to change permissions:
sudo chmod u+s /bin/ping

I redo permission checks by:

ls -l /bin/ping

And the output is changed to:

-rwsr-xr-x 1 root root 72776 Jan 30 2020 /bin/ping

Note that the bolded letter s is changed from the previous value of x.

And what does this s mean?

“It means “set-uid” when run this program: the program doesn’t run with the privilege of user who ran it, instead, with the privilege of file owner. “

The reference article is here: https://dev.to/0xbf/you-know-rwx-but-what-is-rws-when-run-ls-l-linux-tips-549c

Now ping command can be executed by a non-root user like:

 

 


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *