LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This 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


Reply
  Search this Thread
Old 01-31-2007, 04:32 AM   #31
capricorn80
Member
 
Registered: Jun 2006
Distribution: CentOS
Posts: 154

Rep: Reputation: 15

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.
 
Old 02-06-2007, 11:09 PM   #32
capricorn80
Member
 
Registered: Jun 2006
Distribution: CentOS
Posts: 154

Rep: Reputation: 15
need reply.
 
Old 02-07-2007, 12:42 AM   #33
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by capricorn80
and in the end save this as vol.sh and run it as ./vol.sh . so it will work fine ?
No, this code is not a shell script but a C program. Moreover, your change is beaking its syntax.

You need to save it with the ".c" extension and compile it to get an executable.
 
Old 02-07-2007, 05:24 AM   #34
capricorn80
Member
 
Registered: Jun 2006
Distribution: CentOS
Posts: 154

Rep: Reputation: 15
#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 ?
 
Old 02-07-2007, 06:48 AM   #35
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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
 
Old 02-12-2007, 02:08 AM   #36
capricorn80
Member
 
Registered: Jun 2006
Distribution: CentOS
Posts: 154

Rep: Reputation: 15
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.
 
Old 02-12-2007, 05:13 AM   #37
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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.
 
Old 02-12-2007, 08:07 AM   #38
capricorn80
Member
 
Registered: Jun 2006
Distribution: CentOS
Posts: 154

Rep: Reputation: 15
again difficult answer.
 
Old 02-12-2007, 11:31 AM   #39
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
What is difficult ?
 
Old 02-15-2007, 02:24 AM   #40
capricorn80
Member
 
Registered: Jun 2006
Distribution: CentOS
Posts: 154

Rep: Reputation: 15
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
 
Old 02-15-2007, 02:40 AM   #41
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
This has already been answered in this thread (sudo and alternatives). Feel free to read it from the beginning.
 
  


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
Solaris 10 can't mount a CentOS share ALUOp Linux - Networking 2 11-08-2008 06:32 AM
Cant mount UFS in Solaris but can in Linux sstallion Linux - Newbie 1 10-28-2004 07:47 AM
mount usb module then mount usb hard drive guanyu Linux - Hardware 1 10-08-2003 11:50 AM
How to mount Solaris 2.6 Floppy? leverite Linux - Newbie 2 09-04-2003 09:17 PM
nfs mount of solaris drive starkeylabs Linux - Networking 4 06-20-2003 10:16 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 07:38 AM.

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