- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- User => IP-Adress
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 03:28 AM
05-07-2003 03:28 AM
i am looking for a solution for the following:
Actually we have two applications on two servers. On both of the servers there are users which have to log into UNIX to use the application. The usernames on both machines are equal for each user, but the .profile is not as the applications use different versions of JRE etc.
Now we are migrating the applications to a cluster on a new high performance system and want them to be able to run on one cluster node.
The Problem is, that the same user must have different profiles depending on the ip-adress (each of them is assigned to a virtual interface on the machine) on which they log on, as this adress indicates the application the user wants to use.
Has anyone got a solution for the problem of determining on which interface a UNIX-User connected to a machine ?
The idea behind this is, to determine the ip adress / interface on which the user connected and run the correct part of .profile to set environment variables etc.
I tried some tricks with ps -fp $$ to get the tty but I cannot obtain the IP-Adress which the tty is connected to.
I also tried netstat and lsof but they were not showing enough information for the assignment of a user login to the interface he connected on.
Any Ideas ?
Christoph Rothe
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 03:45 AM
05-07-2003 03:45 AM
Re: User => IP-Adress
You can try to use "who -u | grep tty" it will give the address/host name of the machine from where the connection comes.
regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 03:49 AM
05-07-2003 03:49 AM
SolutionYou can do this with lsof
in /etc/profile create a function like this:
function pkg_loc
{
P_ID=$$
TTY=`tty`
TTY=`basename $TTY`
PP_ID=$PPID
IP[1]='A.B.C.D' # pkg1
IP[2]='E.F.G.H' # pkg2
for n in 1 2
do
SV[$n]=`/usr/contrib/bin/lsof -i @${IP[$n]} | grep $PP_ID | grep 0u | grep telnetd | awk ' { print $9 } ' | cut -d : -f 1`
if [ x${SV[$n]} != x ]; then
SV_RETURN=${SV[$n]}
SV_RETURN=`echo $SV_RETURN | cut -d . -f 1`
fi
done
}
Then call pkg_loc
pkg_loc
case $SV_RETURN in
pkg1)
export xxxxx
;;
pkg2)
export yyyyy
;;
*)
echo "Error: No host or package found!" > /dev/null
esac
Regards
Rainer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 03:53 AM
05-07-2003 03:53 AM
Re: User => IP-Adress
try this
#finger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 04:37 AM
05-07-2003 04:37 AM
Re: User => IP-Adress
9 out of 10 points. This is nearly what I need :-)
Unfortunately under some circumstances the $PPID of the shell executing is not the telnetd :-( But with some coding in perl, I will get the result I wanted. MANY thanks!
Christoph
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2003 05:46 AM
05-22-2003 05:46 AM
Re: User => IP-Adress
I now wrote a perl script doing what I want... nearly.
Have you tried your script when logged in via xterm ? xterm seems to always open a connection from the interface the routing table tells it to use and not via the (virtual) interface I used for the original connect.
Has anyone any idea how to determine the interface a user connected to when using xterm ?
Christoph