DOS下相关命令

一、windows命令 1、netstat 查看指定端口是否被占用 netstat -ano | findstr 443
windows下:


2、关闭windows server 2008防火墙 netsh advfirewall set allprofiles state off


打开:netsh advfirewall set allprofiles state on 状态:netsh advfirewall show allprofies
3、打开windows server 2008的3389端口 wmic /namespace:\\root\cimv2\terminalservices path
win32_terminalservicesetting where (_CLASS!="") call setallowtsconnections 1


windows命令不区分大小写。

二、Linux命令 1、查看centos的版本 cat /etc/redhat-release


2、查看IP ip addr


3、查看网络状态 systemctl status network.service


4、安装net-tools文件 yum -y install net-tools


5、查看22端口有没有在监听 netstat -an | grep 22


6、查看空口令用户: awk -F: '($2=="!!"){print $1}' /etc/shadow


7、检测UID为0的用户: awk -F: '($3=="0"){print $1}' /etc/passwd


8、查找密码复杂度配置文件 find / -name pwquality.conf


9、查看ssh服务状态 systemctl status sshd


10、编辑sshd_config文件 vi /etc/ssh/sshd_config


11、将adds添加到root组 usermod -g root adds

102135fc3b7e882e03.png (67.46 KB, 下载次数: 8)

原文链接:,转发请注明来源!