Capture the original user


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Capture the original user
# 1  
Old 09-12-2011
Capture the original user

in our environment role ids are created in unix to which user does su.
say my individual id is drout and a role is devid.

i will login to drout
the su - devid
password : <nothing > password less role id
then i will login to devid.

can i write a function and pass it in a script while i logged in to devid which will say my original user id drout.

say orig_user_id=function() ..

function() should return my user id and assign to the vvaribale which can be used at different places.
# 2  
Old 09-13-2011
Solaris?

--ahamed
# 3  
Old 09-13-2011
sudo is a great utility for this sort of thing, and it sets SUDO_USER for easy access to previous user ID.
# 4  
Old 09-13-2011
yes sun solaris

in our env we dont use sudo.we have role ids and we use the below command

individual id >

su - roleid
passwod:

roleid >
# 5  
Old 09-13-2011
You could try $LOGNAME if not su to role and then set | grep origuserid (where origuserid is userid you were before) to see if any variables still store the origuserid.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find Original user who executed the command

Hi Team, Please help me with the below question. SunOS 5.10 Shell: -bash I am trying to find the original user who executed a command on my development server. In my dev server users login using their personal id and sudo to a common id using 'sudo -u commonid -i'. Once logged in as... (6 Replies)
Discussion started by: sam99
6 Replies

2. Emergency UNIX and Linux Support

A way to capture the user list

Can someone please help me with a way to generate a user list on a system along with the group to which the id belongs? (8 Replies)
Discussion started by: ggayathri
8 Replies

3. HP-UX

How capture all user command line output?

Hi I want to know how capture all user command line output and save this commands and outputs to text files? if you have script for this subject please give me.:o please help me thank you (6 Replies)
Discussion started by: amvhd
6 Replies

4. Shell Programming and Scripting

Why the cp keeps the original ownership?

I want to copy a file from another user to my owner directory, and want to change the ownership to my account. in jung's directory: -rwxr-xr-x 1 jung smart 23 Dec 1 2005 .runme cp /home/jung/runme . under my directory: -rwxr-xr-x 1 jung smart 23 Dec 1... (1 Reply)
Discussion started by: freelong
1 Replies

5. UNIX for Dummies Questions & Answers

Where can I get original copy of Unices

BSD, AFAIK, Linux, etc are developed/based upon UNIX... but they are not UNIX... I'm wandering where can I obtain a original copy of UNIX(without flavor) (1 Reply)
Discussion started by: laduch
1 Replies

6. UNIX for Advanced & Expert Users

Capture of all commands issued by the user “root”

I have to write a script (not C based) that allows to capture of all commands issued by the user “root”. First, I tried to monitor the .bash_history but the commands are written in chunk after the .bash_history is closed. How can I capture the commands in Real-Time without waiting root to... (4 Replies)
Discussion started by: elieifrah@gmail
4 Replies

7. UNIX for Dummies Questions & Answers

about UNIX? original version?

sorry for my English We'll report about Unix in my school, for Operating Systems subject... with Installation demo.... I'm wondering if System V, which is from original developers AT&T still exist and downloadable? because I cant find it anywhere... then i found out that Solaris, MacOS... (4 Replies)
Discussion started by: slowchem
4 Replies

8. Shell Programming and Scripting

Capture user imput commands

Hi all, I have a problem which needs to be solved soon because it affects auditing capabilities. There is an application id that has to be used by other users for the purpose of production support. The application user id uses C shell. We allow users to switch to the application user id based... (1 Reply)
Discussion started by: s_saran
1 Replies

9. UNIX for Dummies Questions & Answers

Sort - original order .... Help

Hi all, I want to sort a file based on the number in the 9th column I've tried both of the following commands sort -k 9,9n file_to_sort.dat sort +8 -n file_to_sort.dat both resulting in the same output which does sort col 9 nummerically but it doesn't output the lines in the original... (2 Replies)
Discussion started by: olga
2 Replies

10. UNIX for Dummies Questions & Answers

Original Path

I've got one I haven't been able to figure out. 1. A shell script exists- /junk/junk1/junk2/junk3.sh 2. From within the above named shell script, I want to know the full path of the above named shell script. Even if I execute the shell script from a directory other than the one it resides in,... (5 Replies)
Discussion started by: therealtiger
5 Replies
Login or Register to Ask a Question