{"id":170,"date":"2020-11-10T10:24:03","date_gmt":"2020-11-10T02:24:03","guid":{"rendered":"https:\/\/www.92k.xin\/?p=170"},"modified":"2020-11-10T10:24:04","modified_gmt":"2020-11-10T02:24:04","slug":"linux%e4%bf%ae%e6%94%b9ssh%e7%ab%af%e5%8f%a3","status":"publish","type":"post","link":"https:\/\/www.92k.xin\/?p=170","title":{"rendered":"Linux\u4fee\u6539ssh\u7aef\u53e3"},"content":{"rendered":"\n
\u4e3a\u4e86Linux\u7684\u5b89\u5168\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539ssh\u7684\u9ed8\u8ba4\u767b\u5f55\u7aef\u53e3\u3002<\/p>\n\n\n\n
\u6211\u4eec\u4ee5centos7\u4e3a\u4f8b\u8fdb\u884c\u4fee\u6539\uff0c\u9ed8\u8ba4\u7aef\u53e3\u6539\u523012345\uff1a<\/p>\n\n\n\n
1\u3001\u5b89\u5168\u5185\u6838\u90e8\u5206\u7684ssh\uff1a<\/p>\n\n\n\n
yum -y install policycoreutils-python\nsemanage port -a -t ssh_port_t -p tcp 12345<\/pre><\/div>\n\n\n\n2\u3001\u4fee\u6539\u9632\u706b\u5899:<\/p>\n\n\n\n
iptables\u7248\u672c<\/p>\n\n\n\n
iptables -A INPUT -p tcp -m multiport --dport 12345 -j ACCEPT\nservice iptables save\nservice iptables restart<\/pre><\/div>\n\n\n\nfirewalld\u7248\u672c<\/p>\n\n\n\n
firewall-cmd --zone=public --add-port=12345\/tcp --permanent\nfirewall-cmd --reload<\/pre><\/div>\n\n\n\n3\u3001\u589e\u52a0sshd\u7684\u7aef\u53e3\uff1a<\/p>\n\n\n\n
\u4fee\u6539\/etc\/ssh\/sshd_config\u6587\u4ef6\uff0c\u4fee\u6539 #Port=22\uff0c\u6539\u6210<\/p>\n\n\n\n
Port=22\nPort=12345<\/pre><\/div>\n\n\n\n4\u3001\u91cd\u542fsshd\u670d\u52a1\uff0c systemctl restart sshd.service<\/p>\n\n\n\n
5\u3001\u6d4b\u8bd5sshd 12345\u7aef\u53e3\u662f\u5426\u5df2\u7ecf\u5f00\u653e\u3002<\/p>\n\n\n\n
6\u3001\u786e\u8ba4\u767b\u5f55\u65e0\u8bef\u540e\uff0c\u5bf9\u7b2c\u4e09\u6b65\u7684Port=22\u6ce8\u91ca\u6389\uff0c\u91cd\u590d\u7b2c\u56db\u6b65\u3002\u5173\u95edsshd\u7684\u9ed8\u8ba4\u7aef\u53e3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u4e3a\u4e86Linux\u7684\u5b89\u5168\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539ssh\u7684\u9ed8\u8ba4\u767b\u5f55\u7aef\u53e3\u3002 \u6211\u4eec\u4ee5centos7\u4e3a\u4f8b\u8fdb\u884c\u4fee\u6539\uff0c\u9ed8\u8ba4\u7aef\u53e3\u6539\u5230123… <\/p>\n