如何指定ssh服务端监听IP
Last updated
2023-01-28 10:40:35
{"value":"### \u95ee\u9898\u63cf\u8ff0\n\n\u62e5\u6709\u4e00\u53f0\u4e91\u670d\u52a1\u5668\uff0c\u8fd9\u91cc\u6d4b\u8bd5\u4f7f\u7528CentOS\u955c\u50cf\u3002\u8fd9\u53f0\u4e91\u670d\u52a1\u5668\u62e5\u6709\u591a\u4e2a\u516c\u7f51IP\uff0c\u73b0\u5728\u60f3\u8981\u6307\u5b9a\u4e00\u4e2a\u516c\u7f51IP\u4f5c\u4e3assh\u8fdc\u7a0b\u670d\u52a1\u7aef\u76d1\u542cIP\uff0c\u5176\u4ed6IP\u4e0d\u53ef\u4f5c\u4e3assh\u670d\u52a1\u76d1\u542c\u7aef\u53e3\u3002\n\n### \u89e3\u51b3\u65b9\u6cd5\n\n\u4fee\u6539ssh\u670d\u52a1\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4ece\u800c\u6307\u5b9assh\u670d\u52a1\u7aef\u76d1\u542cIP\uff0c\u4e5f\u53ef\u4ee5\u5728\u6b64\u4fee\u6539\u670d\u52a1\u7aef\u53e3\u3002\n\n\u6ce8\u610f\uff1a\u4efb\u4f55\u4fee\u6539\u64cd\u4f5c\u90fd\u5efa\u8bae\u5907\u4efd\u597d\u6570\u636e\u6216\u8005\u662f\u5feb\u7167\u4fdd\u5b58\uff01\n\n### \u64cd\u4f5c\u6b65\u9aa4\n\n1.\u6253\u5f00ssh\u670d\u52a1\u914d\u7f6e\u6587\u4ef6\u3002\n\n vi \/etc\/ssh\/sshd_config\n\n2.\u627e\u5230\u5982\u4e0b\u53c2\u6570\uff0c\u5e76\u6309\u9700\u6c42\u4fee\u6539\u3002\n\n #Port 22 #\u53ef\u4fee\u6539ssh\u8bbf\u95ee\u7aef\u53e3\n #AddressFamily any \n #ListenAddress 0.0.0.0 #\u76d1\u542cIPv4\u5730\u5740\uff0c0.0.0.0\u9ed8\u8ba4\u6240\u6709IP\u90fd\u884c\n #ListenAddress :: #\u76d1\u542cIPv6\u5730\u5740\n\n\u8fd9\u91cc\u4e3e\u4f8b\uff0c\u8fd9\u53f0Linux\u4e91\u670d\u52a1\u5668\u62e5\u6709IP\n\n 192.168.1.2\n 192.168.1.3\n 192.168.1.4\n 192.168.1.5\n 192.168.1.6\n\u73b0\u5728\u628a192.168.1.3\u4f5c\u4e3assh\u670d\u52a1\u7aef\u76d1\u542cIP\uff0c\u4fee\u6539\u5982\u4e0b\n\n #Port 22\n #AddressFamily any\n ListenAddress 192.168.1.3\n #ListenAddress ::\n\n\u5982\u679c\u662f\u9700\u89812\u4e2aIP\u53ca\u4ee5\u4e0a\u4f5c\u4e3a\u76d1\u542cIP\uff0c\u5219\u5f80\u4e0b\u7ee7\u7eed\u6dfb\u52a0\u3002\n\n #Port 22\n #AddressFamily any\n ListenAddress 192.168.1.3\n ListenAddress 192.168.1.5\n #ListenAddress ::\n\n3.\u4fee\u6539\u5b8cssh\u670d\u52a1\u914d\u7f6e\u6587\u4ef6\u540e\uff0c\u9700\u8981\u91cd\u542fssh\u670d\u52a1\u624d\u80fd\u751f\u6548\u914d\u7f6e\uff0c\u64cd\u4f5c\u547d\u4ee4\u5982\u4e0b\uff1a\n\n systemctl restart sshd\n\n\u5230\u6b64\u64cd\u4f5c\u5c31\u5168\u90e8\u5b8c\u6210\u4e86\u3002\u5982\u679c\u9700\u8981\u4fee\u6539ssh\u8fdc\u7a0b\u7aef\u53e3\u7684\u8bf7\u53c2\u8003\u4fee\u6539\u8fdc\u7a0b\u7aef\u53e3\u6587\u6863\uff01"}