Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
suppose if i have group id 10 ,12 and 20 and i want that people of group 10,12 and 20 can run the volmgt command. so i do
#include <unistd.h>
#include <stdlib.h>
#define ALLOWED_GROUP 12345 (Edit by me) ALLOWED_GROUP 10,12,20
int main()
{
if(getgid==ALLOWED_GROUP)
{
setuid(0);
setgid(0);
system("/etc/init.d/volmgt stop");
system("/etc/init.d/volmgt start");
}
else
{
fprintf(stderr,"You aren't allowed to restart vold");
exit(1);
}
return 0;
}
and in the end save this as vol.sh and run it as ./vol.sh . so it will work fine ?
Last edited by capricorn80; 01-31-2007 at 04:34 AM.
#define ALLOWED_GROUP 12345 (Edit by me) ALLOWED_GROUP 10,12,20
i wrote this as an example . i just want to know that if have more then one group then wat should i do as i have 10 , 12 and group 20.
Secondly after gettings its executable wat should i do with that ?
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
Originally Posted by capricorn80
#define ALLOWED_GROUP 12345 (Edit by me) ALLOWED_GROUP 10,12,20
i wrote this as an example . i just want to know that if have more then one group then wat should i do as i have 10 , 12 and group 20.
You should modify the source code, adding a loop to check against each of these values.
Quote:
Secondly after gettings its executable wat should i do with that ?
change its owner to root
setting its setuid-bit
run it
this is rather difficult becuase every time i create a group i have to do changes in script and add that group id to it so that people of that group can execute /etc/init.d/volmgt stop | start .
Is there any other way like we can add permissions to user in Directory Server like we do in Active Directory or any simple way.
Regards.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
You can use an external file storing the list of the groups authorized to run the program, which would have been modified to read this list at run time.
i mean there should be some simple command avaialable which give persmission to all groups to execute the command.
i heard sudo has some thing like that on linux
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.