今天查看logwatch 的邮件,发现有莫名的用户尝试登陆,想看下登陆的用户IP。
系统:Debian13 bookworm
输入last命令,提示:
$ last
-bash: last: command not found
这是因为debian13 把 last移动到了 wtmpdb 包里了。 详细原因。
安装wtmpdb包,然后last命令就可以正常使用了:
$ sudo apt install wtmpdb
$ which last
/usr/bin/last
如果需要查看详细登陆日志,成功、失败、IP等原因,可以通过日志的方式查看,如下:
$ sudo journalctl -r -u ssh