User Tools

Site Tools


lastlog

Linux Shell Last Loged

SSH: SSH, also known as Secure Socket Shell, is a network protocol that provides administrators with a secure way to access a remote computer. It provides a secure encrypted data communications between two computers connecting over an insecure network such as the Internet.

Last Command: The command’last’ is used to check the last login details via SSH. This command will show the recent logins on your system. It will display the logins that are recorded in the active wtmp file and lists all logged in and logged out users. The command ‘lastlog’ also displays the last user logins with the last login time, login username and the used port for it. This command will use a lastlog file to check the last logins.

Commands to check last login details: The last login details of a user or for all active or more inactive users in a server can be found with the SSH commands. Log in to the server as a root user and use the below commands

Displays the list of logged in and logged out users:

last root

Displays the list of logged in and logged out users with the IP address of the source machine:

last root -i
or
last root -i | head -n 50

Displays the list of logged in and logged out users more detailly with available command options:

lastlog

Source: https://www.servercake.blog/check-last-login-details-via-ssh/

SSH Remove SSH Key

ssh-keygen -f "/root/.ssh/known_hosts" -R "[8.8.8.8]:22"

lastlog.txt · Last modified: 2022/12/04 07:32 by norman