Solved

Get information on user login for linux

Posted on 2007-03-31
3
358 Views
Last Modified: 2010-05-18
I want to check on log-in information, I follow some doc and add the following to the end of
/etc/profle

time=`date +%Y%m%d:%H%M%S`
echo "[$time]: $REMOTEHOST : $USER ." > /tmp/userlogin.log
mail -s "User Login !!" EMAILADDRESS < /tmp/userlogin.log
rm /tmp/userlogin.log

When I received the email, Subject reads OK.
However the body of the email contain only date time and user, the IP address it come from
is missing.  

Can anybody lighten me on this ?
0
Comment
Question by:ChanYiuPong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
Nopius earned 500 total points
ID: 18831509
If users connect with 'ssh' then use $SSH_CLIENT instead of $REMOTEHOST.
BTW such kind of notification may be bypassed by clever users...
0
 

Author Comment

by:ChanYiuPong
ID: 18831541
I think you get the 500 points, just one more question on SSH_CLIENT:
I saw a five digit between IP and port, what is that no ?
0
 
LVL 27

Expert Comment

by:Nopius
ID: 18833669
127.0.0.1 51133 22

127.0.0.1 - client's IP
51133 - client's port number
22 - server's port number
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question