Solved

Get information on user login for linux

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to line 1 50
E-mail settings for Fail2ban 7 132
zmeu infection? 49 206
The endless cat and mouse game of fail2ban 4 119
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…
Fine Tune your automatic Updates for Ubuntu / Debian
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

776 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