Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get information on user login for linux

Posted on 2007-03-31
3
Medium Priority
?
360 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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

​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…
Fine Tune your automatic Updates for Ubuntu / Debian
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

704 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