Others Running a script as owner


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Others Running a script as owner
# 1  
Old 11-07-2011
Others Running a script as owner

Hi All,

I have a script in which the contents of the script can be run only with Admin account (inst1).
the script has connecting to database and performing some routine database admin tasks. This script should be able to execute by non admin (devp2) user, but the script itself should be running as admin user. is there a way to do this? Not sure if we can do this using sticky bit (after granting execute to public on test.sh) tried chmod2777, but no luck, any Advise please? Appreciate your help, Thanks!

OS: AIX 6.1

-rwxr--r-- 1 Inst1 group1 104 Nov 07 16:50 test.sh

user devp2(group: group2) should be able to execute it
# 2  
Old 11-07-2011
You can use sudoers for this...
Have an entry like this in the /etc/sudoers file
Code:
devp2 ALL=(inst1)NOPASSWD:/full/path/to/script

Execute the script from devp2's login like this
Code:
sudo -u inst1 /full/path/to/the/script

HTH
--ahamed
# 3  
Old 11-07-2011
setuid doesn't work on scripts because of the way they're run with an interpreter instead of directly loaded and executed on the host processor.

You could give users permissions to run that script and only that script via sudo.

[edit] Curses, foiled again Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Why script is running sometimes and not running sometimes?

Hi, I have a script which does couple of database connection and run some SELECT queries to get some output in the file. I am surprised to see :eek: that when i run my script some times it gives the desired out put and sometimes it shows some error :confused: . Suppose if i execute it say... (3 Replies)
Discussion started by: Sharma331
3 Replies

2. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. AIX

Command or script to inform server owner about process

Hi all, How to inform server owner if the particular process is down. I need command or script to do the above. TIA (3 Replies)
Discussion started by: sumanthupar
3 Replies

4. Solaris

Privileges : modify dir/file owner by other that's not owner

i need to do the following operations in solaris 10: 1.change owner and group owner for files which are not owned by the current user and user group 2.to can delete files in the /tmp directory which are not of the current user 3. allow to a standard user the deletion of files in the /tmp... (1 Reply)
Discussion started by: sirmark
1 Replies

5. Shell Programming and Scripting

Shell script that lists files with different owner than the folder

Hello, I'm trying to write a script which is listing files based on different preferences, like filetype or permissions. All is fine, except for one: I want to list files in /home which has a different owner than the home directory it is in. Here is an example: /home/UserA is the directory, and... (10 Replies)
Discussion started by: Zwiebi
10 Replies

6. UNIX for Advanced & Expert Users

How UNIX admin set up this? how files of 744 of other owner can be removed by another owner?

Hi all, We have some files are under 744 permissions and the the owner is say owner1 and group1. Now we have another user owner2 of group2, owner2 can remove files of the owner1 and the permission of those files are 744, unix admin told us he did some config at his side so we can do that. ... (14 Replies)
Discussion started by: TheGunMan
14 Replies

7. Solaris

Running from Shell Vs running from RC script

Hi, i have a script which need to do behave differently when run as a startup process from init.d/ rc2.d script and when run manually from shell. How do i distinguish whether my script is run by init process or by shell?? Will the command /proc/$$/psinfo | grep "myscript" work well???... (2 Replies)
Discussion started by: vickylife
2 Replies

8. UNIX for Dummies Questions & Answers

status of the script running under a particular owner?

How to track the status of a shell script running under a particular owner which is running in the background? (2 Replies)
Discussion started by: ishmael^soyuz
2 Replies

9. Solaris

Owner of file gets 'not owner' error for chgrp

Hi Folks, I know that changing users and groups is pretty basic admin, but this one has got me stumped. When I try to change the group of a file for which I am the owner for, it still gives me a 'Not owner' error. For example, when I am logged in as 'webadmin', I have the following file: ... (4 Replies)
Discussion started by: brizrobbo
4 Replies

10. UNIX for Advanced & Expert Users

running script as different owner

We need to let out test team start/stop some of the billing engines which require being ran as the owner: appadm yet we don't want to give them the password. Is there a command like sudo or su that will allow this, i.e. giving them the ability to only run a script that will start/stop a set of... (1 Reply)
Discussion started by: jph
1 Replies
Login or Register to Ask a Question