进行一些平台自动化并计划围绕用户ssh会话的活动时间设计一些逻辑。有没有办法找到?
答案 0 :(得分:1)
使用ps
命令怎么样?
[STEP 101] # ps -C sshd o user,pid,comm,lstart
USER PID COMMAND STARTED
root 603 sshd Thu Mar 9 11:48:29 2017
root 15147 sshd Mon Mar 13 10:19:21 2017
root 16193 sshd Mon Mar 13 10:19:43 2017
root 19858 sshd Mon Mar 13 10:23:06 2017
pynexj 19860 sshd Mon Mar 13 10:23:06 2017
root 21444 sshd Mon Mar 13 15:11:58 2017
root 22526 sshd Mon Mar 13 17:24:35 2017
root 70528 sshd Wed Apr 12 17:14:12 2017
[STEP 102] #
答案 1 :(得分:0)
你检查过"最后"的输出,也许这就足够了?
server ~ $ last
root pts/0 10.31.1.162 Fri Dec 11 10:35 still logged in
root pts/0 10.31.1.162 Thu Dec 10 11:12 - 11:22 (00:09)
root pts/0 10.31.1.162 Thu Dec 10 09:19 - 11:09 (01:50)