2020年5月5日星期二

GCP Centos7 改ROOT SSH端口 && 启用rc.local

sudo -i

passwd root
新建root密码

修改sshd_config
sudo vi /etc/ssh/sshd_config

# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
Port 22
Port 2244
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

PermitRootLogin改为yes
PermitEmptyPasswords改为yes


新建 SELinux监听ssh 2244
sudo semanage port -a -t ssh_port_t -p tcp 2244
sudo firewall-cmd --permanent --zone=public --add-port=2244/tcp

reboot 后可从22和2244 SSH登入。
如有问题请用22重新登入修正。没问题的话sshd_config去掉22即可

===============启用rc.local======================

chmod +x /etc/rc.d/rc.local
ll /etc/rc.d/rc.local


没有评论:

发表评论

openwrt在线编译 插件名字查找

openwrt在线编译 https://firmware-selector.staging.immortalwrt.org/ 插件名字查找 https://downloads.staging.immortalwrt.org/releases/23.05.1/packages/x8...