1,用命令查看sshd相关的所有进程UID、PID、PPID、CMD等信息
ps -ef | egrep ‘ssh|UID’
ps -ef |grep ssh
2,用命令查看确定sshd使用的端口,修改该端口为5557验证生效
vi /etc/ssh/sshd_config
port 5557
setenforce 0
systemctl restart sshd
netstat -tnlp | grep ssh
3,查看sshd端口状态,已连接数量和客户端
lsof -i:ssh
5557
4,查看SELinux的状态,并设置为disabled(永久生效)
getenforce查看当前状态
进入selinux
cd /etc/selinux
vi config
SELinux=disabled
getenforce
出现disabled
5,创建一个大小为4G的交换分区,并验证结果
lsblk
free -h
fdisk /dev/sdc
n
p
+1G
t
82
w
mkswp /dev/sdc1
echoaaaosxmxaxmosmoamxos
swapon -a
swapon -s
free -h
6,标记行号查看passwd内容
cat -n /etc/passwd
7,查看系统message日志7月22日当天所有日志输出,重定向至/root/0722msg中
cat /var/log/messages| grep ‘March 7’
cat /var/log/messages| grep ‘March 7’>>/root/0308msg
ls
cat /root/0308msg
或grep ‘Jul 22’ /var/log/messages > /root/o722msg
head -10 /root/0722msg
8,查看内存总的使用情况
free -m
9,查看内存、CPU被不同进程耗用的情况
top