Solved

Get information on user login for linux

Posted on 2007-03-31
3
353 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
  • 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to make upload folder private 12 280
What is Mod Security For WHM and Cpanel 2 86
MySQL User Query Auditing 1 73
WEBSITE Capture via Linux Router 2 87
​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

919 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now