Sponsored Content
Operating Systems Linux Red Hat How to confirm an user logged in is a remote user? Post 302544573 by sysgate on Thursday 4th of August 2011 08:19:14 AM
Old 08-04-2011
What is your definition of remote and local? In terms of IP addresses, or some other meaning?
Also, confirming from where? What is your role on that particular server, root, perhaps?

Depending on your desired usage, you can use 'finger' or even the lightweight version 'pinky' for showing the "From where" field.
If it's SSH session, look for env. variables called SSH_CLIENT or SSH_CONNECTION. Alternatively, you can grep the respective OS log files (/var/log/messages) for a combination of user's login and specific strings.

Last edited by sysgate; 08-04-2011 at 09:20 AM.. Reason: Missed the Red Hat string, editing the post accordingly.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Is user logged on??

How can i check to see if a user is logged on to the network? (1 Reply)
Discussion started by: provo
1 Replies

2. Shell Programming and Scripting

user logged on?

Hi, What commands do i need to check if a user is logged on to the network? thanks. (1 Reply)
Discussion started by: provo
1 Replies

3. Shell Programming and Scripting

script on user who logged in????

writing a script that will check every 5 seconds whether a particular user has logged into the system # Determine if someone is logged on # Version 4.0 if then echo “ Incorrect number of arguments” echo “Usage: $ ison4 <user>” else user=“$1” if who | grep “$user” > /dev/null then... (2 Replies)
Discussion started by: kim187
2 Replies

4. UNIX for Advanced & Expert Users

Send email as a different user than the user logged in

Hi I am using mailx to send email and am wondering if there is a way I can send the email from a different user than the user logged in. something like do-not-reply@xyz.com Thank you. (1 Reply)
Discussion started by: rakeshou
1 Replies

5. UNIX for Advanced & Expert Users

currenlty logged in user on remote computer

Hello everyone Does anyone know, if there is a command that tells you who is logged in on remote host? I'm ssh-ing as root to the remote host and then run whoami but that doesn't tells me who is logged in that particular computer instead shows my remote login. Is there a way to do that?... (2 Replies)
Discussion started by: goude
2 Replies

6. Programming

Check if user logged into remote machine via C++ / Java

Hi, I have a program running on HP-UX and it must checkwhether a user has already logged-in to another machine. The hostname of the other machine is known when the check has to be made. Is there a way which this can be accomplished using C++ or Java? If not I could parse the output of a... (6 Replies)
Discussion started by: johnmmcparland
6 Replies

7. Shell Programming and Scripting

User Logged In The Most - Bash

Hi, first time poster, newbie to Bash. I'm looking to get the username of the user who's been logged into a computer the most / longest. I am new to Bash but am familiar with other scripting languages, mainly PHP. So I have a general idea about how to go about the script logic, but don't know... (13 Replies)
Discussion started by: Panman82
13 Replies

8. Shell Programming and Scripting

Does running a cron job of a user require the user to be logged in?

Suppose user 'asdf' is not logged into server 'bbbb', but the server is up. User 'asdf' has cron job. Will it be executed? (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

9. Shell Programming and Scripting

Last user logged in

hi! How can I find into: /var/log/messages.4 /var/log/messages.3 /var/log/messages.2 /var/log/messages.1 /var/log/messages The last user do a login? (for example user1) My idea is to search by the pattern "Accepted password for" buy I necessary search into all files first and in the... (2 Replies)
Discussion started by: guif
2 Replies

10. Shell Programming and Scripting

Logged in windows user name

Hi All, We use putty to connect to a unix box. We want to identify the folks involved in running certain shell scripts on the server. I want to identify the windows user id of those folks who have logged through Putty to run the scripts.As unix-id is shared by more than two folks, tracking... (3 Replies)
Discussion started by: mdkareemuddin
3 Replies
WHO(1)							    BSD General Commands Manual 						    WHO(1)

NAME
who -- display who is on the system SYNOPSIS
who [-abHmqsTu] [am I] [file] DESCRIPTION
The who utility displays information about currently logged in users. By default, this includes the login name, tty name, date and time of login and remote hostname if not local. The options are as follows: -a Equivalent to -bTu, with the exception that output is not restricted to the time and date of the last system reboot. -b Write the time and date of the last system reboot. -H Write column headings above the output. -m Show information about the terminal attached to standard input only. -q ``Quick mode'': List the names and number of logged in users in columns. All other command line options are ignored. -s Show the name, line and time fields only. This is the default. -T Indicate whether each user is accepting messages. One of the following characters is written: + User is accepting messages. - User is not accepting messages. ? An error occurred. -u Show idle time for each user in hours and minutes as hh:mm, '.' if the user has been idle less than a minute, and ``old'' if the user has been idle more than 24 hours. am I Equivalent to -m. By default, who gathers information from the file /var/run/utx.active. An alternate file may be specified which is usually /var/log/utx.log (or /var/log/utx.log.[0-6] depending on site policy as utx.log can grow quite large and daily versions may or may not be kept around after compression by ac(8)). The utx.log file contains a record of every login, logout, crash, shutdown and date change since utx.log was last truncated or created. If /var/log/utx.log is being used as the file, the user name may be empty or one of the special characters '|', '}' and '~'. Logouts produce an output line without any user name. For more information on the special characters, see getutxent(3). ENVIRONMENT
The COLUMNS, LANG, LC_ALL and LC_TIME environment variables affect the execution of who as described in environ(7). FILES
/var/run/utx.active /var/log/utx.log /var/log/utx.log.[0-6] EXIT STATUS
The who utility exits 0 on success, and >0 if an error occurs. SEE ALSO
last(1), users(1), w(1), getutxent(3) STANDARDS
The who utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
A who command appeared in Version 1 AT&T UNIX. BSD
February 11, 2012 BSD
All times are GMT -4. The time now is 02:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy