{"id":85732,"date":"2023-12-24T05:25:27","date_gmt":"2023-12-23T21:25:27","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=85732"},"modified":"2023-12-24T05:25:27","modified_gmt":"2023-12-23T21:25:27","slug":"centos-ssh-ip-user","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos-ssh-ip-user.html","title":{"rendered":"CentOS \u4e0bSSH\u9650\u5236IP\u548c\u7528\u6237\u767b\u5f55"},"content":{"rendered":"
CentOS \u4e0b\u8bbe\u7f6eSSH\u53ea\u5141\u8bb8\u7279\u5b9a\u7528\u6237\u4ece\u7279\u5b9a\u7684IP\u767b\u5f55\uff0c\u5176\u5b83\u672a\u7ecf\u5141\u8bb8\u7684\u7528\u6237\u548cIP\u90fd\u4e0d\u80fd\u767b\u5f55\u3002<\/p>\n
192.168.1.81\uff1aCentOS 6<\/p>\n
192.168.0.222\uff1aWin 10<\/p>\n
192.168.1.135\uff1aWin 8.1<\/p><\/blockquote>\n
\u672a\u505a\u4efb\u4f55\u8bbe\u7f6e\u65f6192.168.0.222\u548c192.168.1.135\u90fd\u80fd\u767b\u5f55192.168.1.81\u3002
\n192.168.0.222<\/span>
\n
\n192.168.1.135<\/span>
\n<\/p>\n\u793a\u4f8b1\uff1a\u53ea\u5141\u8bb8192.168.0.222\u767b\u5f55192.168.1.81<\/strong><\/div>\n# vim \/etc\/hosts.allow<\/span>\u6700\u540e\u4e00\u884c\u52a0\u5165\uff1a
\nsshd:192.168.0.222:allow \/\/\u591a\u4e2aIP\u53ef\u4ee5\u6309\u7167\u6b64\u683c\u5f0f\u5199\u591a\u884c<\/code>
\n# vim \/etc\/hosts.deny<\/span>\u6700\u540e\u4e00\u884c\u52a0\u5165\uff1a
\nsshd:ALL \/\/\u9664\u4e86\u4e0a\u9762\u5141\u8bb8\u767b\u5f55\u7684IP\uff0c\u5176\u5b83IP\u90fd\u62d2\u7edd\u767b\u5f55
\n# service sshd restart<\/code>
\n192.168.0.222\u80fd\u6b63\u5e38\u767b\u5f55<\/span>
\n
\n192.168.1.135\u4e0d\u80fd\u6b63\u5e38\u767b\u5f55<\/span>
\n<\/p>\n\u793a\u4f8b2\uff1a\u53ea\u5141\u8bb8192.168.1\u7f51\u6bb5\u7684\u4e3b\u673a\u767b\u5f55192.168.1.81<\/strong><\/div>\n# vim \/etc\/hosts.allow<\/span>\u6700\u540e\u4e00\u884c\u52a0\u5165
\nsshd:192.168.1.*:allow<\/code><\/p>\n
# vim \/etc\/hosts.deny<\/span>\u6700\u540e\u4e00\u884c\u52a0\u5165\uff1a
\nsshd:ALL<\/code><\/p>\n
# service sshd restart
\n192.168.0.222\u4e0d\u80fd\u6b63\u5e38\u767b\u5f55<\/span>
\n
\n192.168.1.135\u80fd\u6b63\u5e38\u767b\u5f55<\/span>
\n<\/p>\n\u793a\u4f8b3\uff1a\u53ea\u5141\u8bb8192.168.0.222\u4ee5keyso\u7528\u6237\u8eab\u4efd\u3001192.168.1.135\u4ee5root\u7528\u6237\u8eab\u4efd\u767b\u5f55192.168.1.81<\/strong><\/div>\n# vim \/etc\/ssh\/sshd_config<\/span>\u6700\u540e\u4e00\u884c\u52a0\u5165
\nAllowUsers keyso@192.168.0.222 root@192.168.1.135 \/\/\u591a\u4e2a\u7528\u6237\u540d@IP\u4e4b\u95f4\u4f7f\u7528\u7a7a\u683c\u5206\u9694<\/code><\/p>\n
# service sshd restart
\n192.168.0.222\u4ee5\u9ed8\u8ba4\u7684root\u7528\u6237\u8eab\u4efd\u4e0d\u80fd\u6b63\u5e38\u767b\u5f55<\/span>
\n
\n192.168.0.222\u4ee5keyso\u7528\u6237\u8eab\u4efd\u80fd\u6b63\u5e38\u767b\u5f55<\/span>
\n
\n192.168.1.135\u4ee5\u9ed8\u8ba4\u7684root\u7528\u6237\u8eab\u4efd\u80fd\u6b63\u5e38\u767b\u5f55<\/span>
\n<\/p>\n\n\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.linuxidc.com\/Linux\/2017-10\/147255.htm<\/a><\/p>\n