permission script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting permission script
# 1  
Old 04-09-2010
permission script

hi guys

I am working on a menu...
and the menu has some options like check status for services (gmonitor group) or stop - start - restart those same services (gadmin group)

as you see there are 2 main groups gmonitor for monitoring and gadmin for restart - stop - start services

so checking command groups

Code:
#groups root
root : root bin daemon sys adm disk wheel ivmgr httpd gadmin

#groups cgonza
cgonza : cgonza testing gmonitor

basically I want to read the output from groups command and atfer that

if group gadmin is found allow the user to restart services and if gmonitor group is found deny access to restart services

the point is I don't know how to get that groupvar

Code:
if [ "$groupvar" == "gadmin" ]
        then
         restart services options
       else
         echo "... you are not allowed to ..."

thanks a lot
# 2  
Old 04-09-2010
Code:
groups $LOGNAME|grep gadmin >/dev/null
if [ $? = 0 ]
then
  groupvar=gadmin
else
  groupvar=gmonitor
fi

Untested
# 3  
Old 04-10-2010
Quote:
Originally Posted by jgt
Code:
groups $LOGNAME|grep gadmin >/dev/null
if [ $? = 0 ]
then
  groupvar=gadmin
else
  groupvar=gmonitor
fi

Untested

tested and works as it should
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute permission for shell script

Hi All, I am not able to figure out what is the problem with calling a shell script within a shell script. i have given all the permissions to both schell scripts. but when i am seeing the log file error is coming like weekly_us_push_rpts_tst.sh: ./vacation_quota_summary_detail.sh: Execute... (9 Replies)
Discussion started by: krupasindhu18
9 Replies

2. Shell Programming and Scripting

Permission to the script.

I have written a script and now i want to deploy it in PRODUCTION. I want to give all the permission to the user only but not to others.What permission should i use? CHMOD 777 FILENAME? (9 Replies)
Discussion started by: rafa_fed2
9 Replies

3. Shell Programming and Scripting

shell script and Permission denied

Have the following in a .sh file. printf "Installing ... \ r" cd $ ORG_DIR / a_a . / configure> error.log Make 1> error.log 2> error.log make install> error.log But when I run I get the following. install.sh: line 270:. / configure: Permission denied make: *** No rule two make target... (3 Replies)
Discussion started by: Mumie
3 Replies

4. Shell Programming and Scripting

looking for help on script to capture file permission.

Hi Guys, I'm a DBA and need help on shell scripting. My Oracle Database is sitting on HP-UX machine. Anyone has a script that can spool out permission of all oracle binary files in the below directory: /opt/ora10g/oracle/ Format to be spooled out : chmod <exisiting permission> filename... (10 Replies)
Discussion started by: ciaciachew
10 Replies

5. Shell Programming and Scripting

simple bash script permission

I have a bash script, but it needs to have a simple protection with password. So if a user wants to run the script , there should be a kdialog to asks for a password.If the password is correct the script starts to run. It should not be the passord of root or another admin user.Just a password in... (2 Replies)
Discussion started by: poort
2 Replies

6. Solaris

Rc script permission problem

Hi, I have written a startup script which has be started while reboot. I am using Solaris10 machine and i have logged in as a root user. I have written a code the following code cp ./StartService /etc/init.d/ chmod 744 /etc/init.d/StartService //i have given it executable permissions... (3 Replies)
Discussion started by: raghu.amilineni
3 Replies

7. Shell Programming and Scripting

Rc script permission problem

Hi, I have written a startup script which has be started while reboot. I am using Solaris10 machine and i have logged in as a root user. I have written a code the following code cp ./StartService /etc/init.d/ chmod 744 /etc/init.d/StartService //i have given it executable... (0 Replies)
Discussion started by: raghu.amilineni
0 Replies

8. UNIX for Advanced & Expert Users

Script without read permission but execute the script

I have a script, except me no one can read the script but they can execute the script. Is it possible? (14 Replies)
Discussion started by: kingganesh04
14 Replies

9. UNIX for Dummies Questions & Answers

script permission error

I am writing a VERY simple script that copies my catalina log file to a new filename then copies /dev/null inotthe catalina.out. Since the log is the live log, it is open and written to as I copy. I can do the 2 copy commands from a command promp with no problem, it works. I have the probmel in... (2 Replies)
Discussion started by: rschille
2 Replies

10. Shell Programming and Scripting

file permission script

Hi all, I need one script, that will give the out put like all files having 777 permissions and full path from home directory. example:i created 777 permissions files three in my home directory and subdirectories also. i want out put like ./xxxxx/aaa.txt ./xxxxx/zzz/yyy.txt ... (3 Replies)
Discussion started by: krishna176
3 Replies
Login or Register to Ask a Question