Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Ubuntu 12.04 installed and everytime I log in, I would like to see the previous IP addresses that logged in to my server. How would I go about doing this? I have fail2ban installed already.

share|improve this question
    
in sshd_config " PrintLastLog Specifies whether sshd should print the date and time of the last user login when a user logs in interactively. The default is “yes”. " –  c4f4t0r Aug 1 at 16:01
    
where is that file ? –  duckx Aug 1 at 16:03
    
/etc/ssh/sshd_config –  c4f4t0r Aug 1 at 16:25
    
can you print the last 10 IP's that logged in ? –  duckx Aug 1 at 16:28

2 Answers 2

up vote 1 down vote accepted

In your shell initialization script (e.g., ~/.bash_profile) add last --ip --limit 10

share|improve this answer
    
The arguments you suggest for last do not exist. However using limit without arguments usually provides the information asked for (after a rotation, one would need to check one earlier logfile as well.) –  kasperd Aug 1 at 18:40
    
Yeah, Precise uses a last from sysvinit-utils, version 2.88dsf-13.10ubuntu11.1. The one I use in gentoo: last from util-linux 2.24.2 –  Mark Wagner Aug 1 at 20:39

You should see a "Last login from IP" message everytime you login.

You could also use the command "history" to view a log of commands that have been used.

If you want to check the current logged in users, use the command "w"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.