- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Two users logged on same TTY according to who
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
10-11-2006 08:08 AM
10-11-2006 08:08 AM
root: /: who -m -u
chousema pts/0 Oct 11 15:20 . 3869 10.1.5.2:0.0
applmgr pts/0 Oct 11 02:53 . 4306 10.5.2.5
If I 'ps -ef|grep 4306' I get nothing - so why is who telling me about this login that no longer exists?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 08:14 AM
10-11-2006 08:14 AM
Re: Two users logged on same TTY according to who
This is not uncommon. This usually occurs when a session is disconnected without a graceful exit. For instance, this can occur if an end-user in a PC-based telnet session closes the telnet without exiting his/her shell.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 08:30 AM
10-11-2006 08:30 AM
Re: Two users logged on same TTY according to who
Would "not uncommon" be another way of saying "commonly accepted bug" ?
I was parsing 'who -m -R' to find the IP of the client PC, but since it resolves to two different sessions, it's not reliable. Any better way to do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 08:35 AM
10-11-2006 08:35 AM
Re: Two users logged on same TTY according to who
perhaps do a "ps -u" on both, the one w/ running process is the guy you want?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 08:54 AM
10-11-2006 08:54 AM
Re: Two users logged on same TTY according to who
I like that: "not uncommon = commonly accepted bug".
Strictly speaking that's not what I meant. This is akin to killing a process with a 'kill -9' and there for not letting any signal handlers that the user has armed to cleanup temporary files, shared memory, etc.
As for ascertaining which of the entries is correct, I'd simply use the latest session. In that example, that would be pid=3869.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 09:28 AM
10-11-2006 09:28 AM
Re: Two users logged on same TTY according to who
You long-term hard-core folks may be willing to accept and rationalize this, but that doesn't make it any less of a bug! A system should clean up these inconsistencies by itself, and not report them to the user.
As for my overall problem, I guess I'll have to filter the who results based on the PID that exists. Otherwise it's scripting a comparison of date/time which seems like less fun. The other username which is no longer interactively logged on still owns many valid processes on the system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 09:40 AM
10-11-2006 09:40 AM
Re: Two users logged on same TTY according to who
Here's the problem: utmp only has login and termination records (plus some global records about the kernel) and who is trying to put the beginning and ending records together. Since the records are sometimes incomplete (because of the user) who is just guessing.
Additionally, applications can write to utmp and corrupt the contents. So, who is just a simplistic command to track begin/end records. Note that a 'session' is not as fancy as it sounds. Unix simply takes an incoming connection (telnet, rlogin, ssh, etc) and attaches the login program and if validated, attaches a shell to the tty device file which runs profiles and shows a prompt. A sysadmin can (wrongfully) use kill -9 to get rid of the shell and now you have an orphaned start record.
So to determine the users that are currently logged on, you need to define logins. Some users may have a shell prompt, others may be running a menu program. But start by running the ps command through sort as in:
ps -ef | grep -v ^root | sort
You can do some other filters to narrow down the actual login shells. ps is always correct.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 09:48 AM
10-11-2006 09:48 AM
SolutionYou can use fwtmp to read out your utmp file as text, clean it up, and read it back in as binary but I consider this a waste of time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 10:20 AM
10-11-2006 10:20 AM
Re: Two users logged on same TTY according to who
It's a bug that I allowed an unreliable connection? Or an inexperienced user? No points for that!
News flash: The world is unreliable. Users are inexperienced. The computer should be able to deal with it. There's no excuse for reporting false information (JMHO).
Recommmended approach for decades? After all that time, nobody has bothered to fix or rewrite who? What is the recommended method for finding the IP address of the connected device, if not to deal with who?
It's true (and obvious I'm sure) that I'm not an experienced Unix admin and this thread is part of my gaining experience. But I have admin'd various non-Unix OS's over 25 years and have not previously had to deal with a system provided utility that reported false information, where such false reporting was considered acceptable, or even tolerable.
I have my workaround, using ps to filter out bogus PIDs reported by who, but I don't have to like it!