怎樣用命令查詢別人用ssh登入自己本地主機

2021-09-01 19:04:08 字數 902 閱讀 2662

ps -ef|grep sshd

root 1693 1 0 aug13 ? 00:00:00 /usr/sbin/sshd #父程序號是1的是系統服務程序

root 12598 1693 2 14:59 ? 00:00:00 /usr/sbin/sshd #有這個程序說明有sshd遠端客戶登入

root 12638 1693 0 15:02 ? 00:00:00 /usr/sbin/sshd #這是第二個登入使用者

root 12633 12600 0 14:59 pts/0 00:00:00 grep sshd

二、根據登入上來的程序號找到使用者程序

#ps -ef|grep 12598

root 12598 1693 0 14:59 ? 00:00:00 /usr/sbin/sshd

root 12600 12598 0 14:59 pts/0 00:00:00 -bash #第乙個使用者,居然還是用root登入的。

#ps -ef|grep 12633

root 12638 1693 0 15:02 ? 00:00:00 /usr/sbin/sshd

root 12640 12638 0 15:02 pts/1 00:00:00 -bash #第二個使用者

三、根據bash程序的終端號pts/?來確定**

[root@redhat root]# who -a|grep pts/1

root + pts/1 aug 14 15:02 00:03 12640 (192.168.0.123) #登入**ip192.168.0.123

[root@redhat root]# who -a|grep pts/0

root + pts/0 aug 14 14:59 . 12600 (192.168.0.123) #登入**ip192.168.0.123

怎樣用命令開啟mysql?

用命令開啟mysql的方法 1 使用 win r 快捷鍵,開啟 執行 視窗 2 在 執行 視窗中輸入 cmd 回車開啟cmd命令視窗 3 輸入 mysql u root p 命令,回車 4 輸入密碼,隱性顯示,回車即可。使用命令列啟動mysql的方法 首先,使用快捷鍵,同時按住鍵盤的win r 其次...

怎樣用命令列開啟或關閉Windows服務

怎樣用命令列開啟或關閉windows服務 本篇部落格主要包含乙個內容 怎樣用命令列開啟或關閉windows服務 閒話少敘,直奔主題。1.在桌面右擊新建乙個文字文件,然後開啟。2.找到需要開啟或關閉的服務名。有兩種方式,第一種 按下win r鍵,輸入services.msc,然後回車,就能開啟電腦上的...

怎樣用Python寫乙個Linux命令列

一般來說,我們的命令列需要執行兩個及以上的函式,我們先定義兩個簡單的函式。def add x,y x plus y return x y def mul x,y x times y return x y 匯入包 import argparse import sys主函式,執行上面兩個函式的功能。de...