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.
Asked
Active
Viewed 467 times
1
-
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 01 '14 at 16:01
-
where is that file ? – Patoshi パトシ Aug 01 '14 at 16:03
-
/etc/ssh/sshd_config – c4f4t0r Aug 01 '14 at 16:25
-
can you print the last 10 IP's that logged in ? – Patoshi パトシ Aug 01 '14 at 16:28
2 Answers
1
In your shell initialization script (e.g., ~/.bash_profile
) add last --ip --limit 10
![](../../users/profiles/48857.webp)
Mark Wagner
- 17,764
- 2
- 30
- 47
-
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 01 '14 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 01 '14 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"
![](../../users/profiles/229591.webp)
Jose Flores
- 113
- 3