How to get a login name of a person who used 'su' and act with different user-name?
I need to realize the user login name after he/she used the 'su' command to log under another name (for specific privileges.)
I am on SunOS v5.6, and here by now I could not find a way to figured it out.
In another Thread I've get an advise from Linux user to use 'ps afxj' that display a processes tree and shows up the originated 'su' command.
But on Sun I could not find a way to get something simular that would display the 'su'
The main reason for that task is to use the 'write' comand to send a message to people's terminal who is loged by 'su' as a specific user.
I have a script that runs background and monitoring some condition. I would like it time to time to send some message.
It is started by someone, who used 'su', but could after that close the seccion and even log off completely.
Although all the time someone has use the specific user-name, loged by 'su' - it is a production control name.
I need the script to be able send a mesage directly to anyone who now is under that production-control-logname.
Even if you don't have a pretty version of ps (with -forest flag), nor
the ptree app, you can still get the parent pid from a process when
you run a ps -ef.
You should be able to find your process (owned by root), and its
pid. Next to it is the parent pid. Now look for this pid, and _its_
parent pid. And so on.
Another way of finding out more about a process is by looking at its
environment variables. This will work if the user did a su, without
the '-' char as an argument, since most of the original environment
variables will be retained.
fimbo - or I could not understand what you advice, or I did not explain well what I need to have.
You are right, ps -ef could drive me to original process - completely understand PID and PPID relation.
But in our sistem the 'su' command is not visable.
So, how I can know who is under the 'support' login?
One person start a background script and closed the session.
After some period of time script need to display a message, but original session is not available.
But it must to be someone else under the same 'support' id, logged with 'su'
Using the 'write' command is not possible - the 'write' do not see the person after the 'su' - it sais: the 'support' person is not logged.
But I see many processes of the 'support' person and can't write a message to that user.
The 'ptree' is available on this system, but there is no 'su', also
See example.
I have logged in the system with my log ID, and 'su' for the same id (I do not have any other id available).
I have start 'tail -f ..' to recognize process
See the part of 'ptree':
...
I think the ptree is usefull to see, but to follow to the originating PID from script is not comportable.
So, I have resolve my own task, although the main question of this thread is not resolved.
In my situation I knew the log name that is used to start process. And, how it was advised, using the 'ps' though real terminals, I get the acctual log name of the person, who been loged in before 'su'.
I have put it into a function:
(If you see anythink incorrect or should/could be done different - I will appreciate your hints!)
After that it is easy to use 'write' for each returned name
BUT, if the task is to realise who is logged under 'su' - I DO NOT HAVE a solution!
If you see how it could be done in such system as our (where 'su' command is not showed in 'ps' list and represented as a regular log,) show it here.
Hi Experts,
Need your support
Redhat 6.5
I want to create a user with all(read, write, execute) privileges except that user should not be able to create any new user from his login
to perform any task. (10 Replies)
now i have logged in username : ramesh in unix
Now i have to created script file to login into another user and have run a command inside that user and after executing the command i have to exit from that user.
Inside script, i have to login into su - ram along with password : haihow and have to... (4 Replies)
I want to learn AIX. I would like to find someone who would be willing to give me a login to their AIX home lab server. My intent is to poke around and discover the similarities and differences of AIX compared to other *NIXs.
I am a UNIX admin so I can think of what some immediate concerns may... (1 Reply)
Hi Every body,
I would need a shell script program to login as different user and perform some copy commands in the script.
example: Supppose ora_toms is the active user
ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands
... (9 Replies)
I want to set the "logintimes" variable for a user on a server who need access mornings and night how to I set the "logintimes" I want the user to log in from 08:00 to 12:00 and 17:00 to 21:00 is this possible? (1 Reply)
Hello World ~
HW : SUN Fire V240
OS : Solaris 8
Error message prompts 'rmclomv ... SC login failure ...' on terminal.
and
Error Message prompts continually 'SC Login Failure for user Please login:' on Single Mode(init S)
The System is in normal operation, though
In case of rain, Can... (1 Reply)
Hi,
My requirement is that i am login from ROOT in a script but when any
command is coming which is logging to sqlplus then i have to run it with normal user as only normal user have permission to connect to sqlplus .
i tried making a script like this :
#! /bin/ksh
su -... (3 Replies)
I created a user, i login as a root. I add him in the group where he can access and login as a root! I checked it in users' list and in group's list, he is there. My problem is this, I cant login using the username/account I just created! What should i do to use and login the user/account i've just... (5 Replies)
Gud day :)
We have a limited user login so we want to restrict 1 login per user. We have added below script in each user's profile but it is not working :confused: , I displayed the output for COUNT (by inserting echo command) but the value is always 1. Hope you could help me.
Thanks ;) ... (3 Replies)
Dear all members
I've a question basd on an AIX enviroment. In here I've two administrative users, are used for the running application (SAP).
Now my problem's, that's not possible to login over the "normal"
Loginscreen as such a user. If I try this, the FTP connection will
closed at once. It's... (6 Replies)