Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File executable only for users in a certain group in bash shell

Tags:

linux

bash

shell

I just want to know how to make a file executable only for certain group.

I have a file /bin/ping with this permissions

rwxr-xr-x root root 34248 oct 14 2010 /bin/ping

How do I make it only executable for users of a group called "friends", for example?

like image 273
dari1495 Avatar asked Aug 03 '26 11:08

dari1495


2 Answers

If the group "friends" already exist, you can change group by

chown root:friends /bin/ping

and then make it exucutable for that group by

chmod g+x /bin/ping
like image 130
viscerebral Avatar answered Aug 06 '26 03:08

viscerebral


I'd use ACL for this. First revoke permissions for everyone else with standard unix permissions

chmod 754 /bin/ping

then set rule for your group

setfacl -m "g:friends:r-x" /bin/ping
like image 36
Gavin Portwood Avatar answered Aug 06 '26 02:08

Gavin Portwood



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!