ssh是linux的標准配置並且最常用,可以用來判斷端口是否打開
用法: ssh -v -p port username@ip
-v 詳細模式(會打印日志,顯示登錄的細節).
-p 指定端口
username 可以隨意
ip 待測試機器的ip
--------------------------------------------------------------------------------------------------------
pipci@HP:~$ ssh -v -p 111 dd@10.10.10.6
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.10.10.6 [10.10.10.6] port 111.
debug1: Connection established. ##出現Connection established表示建立連接,也就代表着這個端口開放
debug1: key_load_public: No such file or directory
debug1: identity file /home/pipci/.ssh/id_rsa type -1
省略
pipci@HP:~$ ssh -v -p 222 dd@10.10.10.6
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.10.10.6 [10.10.10.6] port 222.
debug1: connect to address 10.10.10.6 port 222: Connection refused
ssh: connect to host 10.10.10.6 port 222: Connection refused ##出現Connection refused表示連接拒絕,也就代表着這個端口關閉
pipci@HP:~$
--------------------------------------------------------------------------------------------------------