- 修改ssh 端口
netstat -anp | grep -i sshd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 20981/sshd
2)
重新设置 SSH 的监听端口,只需修改 /etc/ssh/sshd_config 中的 Port 即可,如:
#Port 22 这一行修改为
Port 22522
3)如果服务器启用了 SELinux,则还需进行额外配置。若SELinux未打开(输出no),直接跳转步骤4.
首先,确认 SELinux 是否启用:
sestatus 2> /dev/null | grep -E -q 'SELinux status:\s+enabled' && echo yes || echo no
输出 yes 即表示启用了 SELinux,那么就需要再对 SELinux 进行配置:
semanage port -a -t ssh_port_t -p tcp 22522
4)重启sshd服务 systemctl restart sshd.service
5)查看SSH服务状态及暴力端口
[root@localhost ~]# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since 三 2019-01-23 17:11:24 CST; 2s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 24291 (sshd)
CGroup: /system.slice/sshd.service
└─24291 /usr/sbin/sshd -D
1月 23 17:11:24 localhost.localdomain systemd[1]: Stopped OpenSSH server daemon.
1月 23 17:11:24 localhost.localdomain systemd[1]: Started OpenSSH server daemon.
1月 23 17:11:24 localhost.localdomain sshd[24291]: Server listening on 0.0.0.0 port 22522.
1月 23 17:11:24 localhost.localdomain sshd[24291]: Server listening on :: port 22522.
[root@localhost ~]#
[root@localhost ~]# netstat -anp | grep -i sshd
tcp 0 0 0.0.0.0:22522 0.0.0.0:* LISTEN 24291/sshd
- ssh 访问
ssh -p 22522 abcd@192.168.1.32
- scp 访问
scp -P 22522 zqd root@192.168.1.32:/root