1

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.

4
  • 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, 2014 at 16:01
  • where is that file ? Aug 1, 2014 at 16:03
  • /etc/ssh/sshd_config
    – c4f4t0r
    Aug 1, 2014 at 16:25
  • can you print the last 10 IP's that logged in ? Aug 1, 2014 at 16:28

2 Answers 2

1

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

2
  • 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, 2014 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 Aug 1, 2014 at 20:39
0

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"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .