- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- MCSG - Identifying package logins
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
01-28-2005 06:08 AM
01-28-2005 06:08 AM
Example, I have PKG1 and PKG2 on SVR1, each package has it’s own IP address.
So if a user telnet/ssh to PKG1 I want .profile to set their environment one way. If they telnet/ssh to PKG2 I want .profile to set their environment a different way.
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2005 06:16 AM
01-28-2005 06:16 AM
SolutionThis script is called from /etc/profile by doing a '. /wartmnt'
The script is /wartmnt and it requires lsof and I script I modified from another called rptree. wartmnt is attached to this post. I'll attach rptree.sh to another post.
# cat /wartmnt
#!/usr/bin/sh
PID=$(ps -t $(tty |sed 's|/dev/||') | grep telnetd | awk '{print $1}')
if [ ! -n "$PID" ]; then
PID=$(/usr/local/bin/rptree.sh $$ | grep telnetd | awk '{print $1}')
fi
TOMACHINE=$([ -n "$PID" ] && /usr/local/bin/lsof -p $PID | grep TCP | awk '{print $9}' | awk -F : '{print $1}' | awk -F . '{print $1}' | uniq)
#echo $PID
#echo $TOMACHINE
if [ $TOMACHINE = "whpackage1.rwp.com" -o $TOMACHINE = "hquwh01.rwp.com" -o $TOMACHINE = "whpackage1" -o $TOMACHINE = "hquwh01" ]
then
export WART=/wart
export MESAVE=/mesave
export INVOICES=/invoices
elif [ $TOMACHINE = "whpackage2" -o $TOMACHINE = "hquwh50" -o $TOMACHINE = "whpackage2.rwp.com" -o $TOMACHINE = "hquwh50.rwp.com" ]
then
export WART=/wart1
export MESAVE=/mesave1
export INVOICES=/invoices1
elif [ $TOMACHINE = "whpackage3" -o $TOMACHINE = "hquwh05" -o $TOMACHINE = "whpackage3.rwp.com" -o $TOMACHINE = "hquwh05.rwp.com" ]
then
export WART=/wart3
export MESAVE=/mesave3
export INVOICES=/invoices3
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2005 06:19 AM
01-28-2005 06:19 AM
Re: MCSG - Identifying package logins
I modified that script to work just the opposite way. This script works its way up the tree looking for all parent processes until it gets to PID 1.
The script is attached as it is a bit too long to post in the thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2005 08:44 AM
01-28-2005 08:44 AM
Re: MCSG - Identifying package logins
If I set suid on lsof it does work.
Anyone have comments on the risks of having lsof suid?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2005 08:47 AM
01-28-2005 08:47 AM
Re: MCSG - Identifying package logins
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2005 09:21 AM
01-28-2005 09:21 AM
Re: MCSG - Identifying package logins
I can't believe HP would even sell MCSG without a feature like this. Although I guess there are many tasks on HP that need lsof to be done right. Like making sure filesystems can be unmounted during Package shutdown! fuser just doesn't cut it. Maybe HP should bundle lsof with HPUX?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2005 10:18 AM
01-28-2005 10:18 AM
Re: MCSG - Identifying package logins
when a user ssh's to the box, sshd will set an SSH_CONNECTION variable. Info looks like
SSH_CONNECTION="client_ip client_port server_ip server_port"
What you'd want to pay attention to is "server_ip" as it would match the package_ip your user ssh'd to.
Hope this info helps,
-denver