Find the user executing a script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find the user executing a script
# 1  
Old 06-14-2006
Find the user executing a script

How do i in a script determine the user that is executing it?
# 2  
Old 06-14-2006
from within the script?
whoami shoud give the username

try echo $(whoami)
# 3  
Old 06-14-2006
Thanks sssow thats what I was after.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to find IP of user machine executing a particular UNIX command?

Hello, Our applications are deployed in SunOS 5.10 servers. All the team members use a same username/pwd to login to the box. Very often we face issue were we could see that weblogic server instance are KILLED and we are not able to trace who executed kill command. All team members use PUTTY to... (2 Replies)
Discussion started by: santtarius
2 Replies

2. UNIX for Dummies Questions & Answers

How to switch the user before executing a shell script from web page??

hi, i want to execute a shell script as a different user. the flow is like this. there is a html web page from which i have to call a shell script. web server is apache. to call the shell script from html page, a perl script is required. so the html page calls the perl script and the perl... (2 Replies)
Discussion started by: Little
2 Replies

3. Shell Programming and Scripting

Knowing the user who is executing my script

Hi, is there any way? I thot of id but it doesnt work quite well :wall: (2 Replies)
Discussion started by: lamachejo
2 Replies

4. Shell Programming and Scripting

getting a string from user while executing a tcl script

Hi All, I am executing a Tcl script and i am trying to get the user input while they execute the script at start itself like >>filename.tcl USERINPUT and then i will take this userinput inside the the tcl assign it to some variable for further manipulation/processing ...... can anyone pls... (1 Reply)
Discussion started by: sukrish
1 Replies

5. Shell Programming and Scripting

Script to find the user of a file and permissions

I have a list of files in a.txt file. For each of the files listed in that file, I would like to obtain the owner of the file and also, the permissions associated with that file. If possible, the group the owner belongs to as well. Can someone help me with a script to find that out. (1 Reply)
Discussion started by: ggayathri
1 Replies

6. Shell Programming and Scripting

Executing program with Perl script but needs user input

Hello, I'm running a perl script to execute a program through my Unix command line. The program requires a user input but I want to automatically have perl input the string. Is there a way to do this? Thanks (1 Reply)
Discussion started by: leonard2352
1 Replies

7. Shell Programming and Scripting

Find username of user running the script

Hello All, If I have a simple cgi script and want to find the name of the person accessing the page, is it possible? How do I get the name of this user? Please help. I was trying a vague method but it doesn't seem to work with all browsers and versions ... $val=$ENV{'HTTP_COOKIE'}; $name... (1 Reply)
Discussion started by: garric
1 Replies

8. SCO

Executing script with root privilages from a user login

I need to regular users to be able to launch a script which does something requiring root privilages. I've tried using chmod 4755 which gives it -rwsr-xr-x permissions but it still can not be run as the regular user. (1 Reply)
Discussion started by: checkpro
1 Replies

9. Shell Programming and Scripting

Shell script to find when user su'ed to root

Does anybody know how to make a shell script that finds all the times that any user su'ed to root and create a cron job sends that file output via e-mail to one user? Thanks!:confused: (1 Reply)
Discussion started by: jrvilino
1 Replies

10. Shell Programming and Scripting

Executing Script of a different user on Same Machine

Hi, I want to execute a script - of different user from my script. I have tried the su command su - username -c "scriptname" it works but asked for password. Is there any way for supplying the password to it thru script, not interactively. Or is there any other way to achieve the... (5 Replies)
Discussion started by: yeheyaansari
5 Replies
Login or Register to Ask a Question