I have built a custom utility in shell script to deploy some files across AIX 6 servers.. I am using the "who am i" command to find out the IP address of the user who is using the utility to deploy the files for audit purpose.
This command returns the output with the user IP address on one server as:
but the other server does not return the IP address
I have looked around --unsuccessfully-- on this forum before putting this as a new post.. any pointers will be appreciated.
Last edited by Scrutinizer; 10-02-2013 at 05:54 PM..
I've seen this happen before, but never discovered why. If you just need the IP Address that current user running the script connected from and they connected via ssh, you can get it from the SSH_CONNECTION environment variable. The following will return the IP Address.
These 2 Users Gave Thanks to in2nix4life For This Post:
I'm curious as well, but at the time that it occurred, I didn't cycles to figure it out, opting for a workaround instead. I've only seen it happen on the one AIX box and haven't seen it occur since.
The difference is the login session: in one case it originated from a terminal ("pts/<n>" is a terminal), in the other case it is from a network line. Only the latter carries an IP address because only here the login process (this is what ultimately feeds "who am i"s output) is aware that there is a network connection involved.
In the other case there might be a network connection involved too, but only to acquire a (virtual) terminal and then use this to log in.
If you need the IP address you are coming from inspect the established network connections, because regardless of the method there must be an established TCP connection behind every session.
I hope this helps.
bakunin
/PS:
This will not work if you use some "man-in-the-middle" to connect: some "putty" over Citrix or similarly working products will show you the IP of the Citrix server, not your own.
Last edited by bakunin; 10-28-2013 at 07:42 AM..
These 3 Users Gave Thanks to bakunin For This Post:
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Could you please let me know the following? I have to find and check first day of each month. I do
fdt=`date +%d`
will it give me on AIX
"1" or "01"
I ask you because I couldn't make real test on first day and don't know
Thanks for contribution (4 Replies)
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
Hi, everyone.
I need to write a program to get io info based on libperfstat.
But the "write time" of a disk is just half of the value get from iostat.
I'm confused and can't explain. Help please.
How I calculate "write service time per sec":
In iostat:
write service... (0 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)