How to check a script was started using 'sudo' ?


 
Thread Tools Search this Thread
Operating Systems AIX How to check a script was started using 'sudo' ?
# 1  
Old 06-10-2009
How to check a script was started using 'sudo' ?

How can I from within a script, find out if that script was started using 'sudo' and by a valid soduer ?
# 2  
Old 06-10-2009
well, this type of situation can depend on several factors..

do the "sudoers" all have full permission? if so then just make the script owned and executable by root only

otherwise you could explicitly list this script in the /etc/sudoers file under each user or group that needs to execute it.

You should be handling this logic in the /etc/sudoers file, not a script itself.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inotifywait restart script prevents reboot when started

Hi, maybe someone could help me optimizing this little script. It works so far, but when running, reboot does not work. If kill inotifywait reboot from shell works. I think some optimization is required here. This script starts at the end of the boot process, from an external device and... (3 Replies)
Discussion started by: lowmaster
3 Replies

2. Solaris

How to check sudo access of other users?

Hi, I always use "sudo -U user -l" as root and it gives me list of sudo access, that person have. But on one Solaris server, I can't run it. recently only I installed latest patchset on this server. Not sure, if that changed something on this. However, sudo package is showing old one. # id -a... (1 Reply)
Discussion started by: ron323232
1 Replies

3. Shell Programming and Scripting

Check whether shell script has started.

How can i ceck as shellscript, if a other shellscript has been started? The other script can bee started by a other user. The task will not run twice (5 Replies)
Discussion started by: Linuxmann
5 Replies

4. UNIX for Dummies Questions & Answers

Show ksh script started on boot

Hi, i need to know, which ksh script are executed on boot (Sun and aix OS). Where can i find it ? (5 Replies)
Discussion started by: nash83
5 Replies

5. Shell Programming and Scripting

how to check whether a process started at particular time

I want to check whether a particular process has started at 10:00a.m or not. I can check process by ps -fu but dont know how to check it with respect to time. Could anyone help me with this? ---------- Post updated at 11:14 AM ---------- Previous update was at 10:52 AM ---------- can i use... (9 Replies)
Discussion started by: kishore kumar
9 Replies

6. Shell Programming and Scripting

Check when user exits SUDO

Hello to everyone, I'm new here and would like to thank everybody for the upcoming support, I know that I will have my question answered here, this community is huge. :) First of all, I´m a DBA and work on a daily basis on Unix environments of all kinds (HP-UX, Solaris, AIX, etc). I have... (8 Replies)
Discussion started by: ZeroBR
8 Replies

7. Shell Programming and Scripting

Time elapsed since script started

Hi I want to know if there is anyway I can find out how long it has been since I started my script or total time it has been since my script is executing. Idea here is I want to check if my script is taking more than 30minutes to execute I want to kill that process. Thanks in advance. (1 Reply)
Discussion started by: dashing201
1 Replies

8. Shell Programming and Scripting

Different time format in script, started in shell or in cron

I try to write a python script, which analyze user logon time with "who" command. When i start script in bash, i get this result: USER=mnadmin tty7 2009-04-18 11:37 (:0) But when i start script in cron, i get result like this: USER=mnadmin tty7 Apr 18 11:37 (:0) I see -... (2 Replies)
Discussion started by: jrush
2 Replies

9. Shell Programming and Scripting

need some help getting started on this script

Hi. I am just getting into scripting. I came into a situation where I need to go through several hundred files on a Linux system and find a couple specific bits of information from within each file. All the files have pretty much identical content except for a view data values on the same two lines... (4 Replies)
Discussion started by: Dave247
4 Replies

10. Shell Programming and Scripting

How to get rid of message when script kills process it started?

When I run the following script I get the following error message whcih I would like to suppress when the kill is issued: ./kill.sh: line 13: 31854 Killed nc -l -p 12345 Script: #!/bin/bash echo running nc in the background nc -l -p 12345 & PID=$! echo nc pid: $PID ... (1 Reply)
Discussion started by: cmarkle
1 Replies
Login or Register to Ask a Question