0

我想在用户 SSH 登录后做一些事情,这与通过公钥或密码不同。PAM 不会参与我的案件。

程序可以通过一种方法从 /var/log/messages 或 /var/log/auth.log 检查 SSH 身份验证信息。但通常,这些文件对普通用户来说是不可读的。也许我可以 chmod o+r,但这听起来不安全。

而且我还检查了一些与 SSH 相关的环境变量,例如“SSH_CONNECTION”,但它们都没有用。

有没有好的方法来做到这一点?感谢帮助 :)

4

2 回答 2

1

Your only way right now is to change the LogLevel in /etc/ssh/sshd_config and parse your syslog output logs to find out what auth method was used.

LogLevel DEBUG have for sure the info needed, but you can probably find it also with VERBOSE level ... test it

于 2012-04-21T19:52:59.010 回答
1

你不能在它之外这样做sshd,而在它里面我知道的唯一方法是使用authorized_keys匹配特定的键并执行特定的命令。

于 2012-04-21T00:27:40.327 回答