1.\u786e\u4fdd\u5171\u4eab\u5185\u5b58\u7684\u5b89\u5168<\/strong><\/div>\n\u9ed1\u5ba2\u653b\u51fb\u603b\u4f1a\u60f3\u67e5\u770b\u5171\u4eab\u5185\u5b58\uff0c\u6240\u4ee5\u4fdd\u8bc1\u5171\u4eab\u5185\u5b58\u7684\u5b89\u5168\u7684\u91cd\u8981\u6027\u4e0d\u8a00\u800c\u55bb\u3002\u53ef\u4ee5\u4fee\u6539 \/etc\/fstab\u6587\u4ef6\u6765\u786e\u4fdd\u5171\u4eab\u5185\u5b58\u7684\u5b89\u5168\u3002<\/p>\n
\u9996\u5148\uff0c\u4f7f\u7528\u7ec8\u7aef\u547d\u4ee4\u6253\u5f00\u6587\u4ef6<\/p>\n
sudo nano \/etc\/fstab <\/pre>\n\u7136\u540e\uff0c\u6587\u4ef6\u7684\u5e95\u90e8\u52a0\u5165\u5982\u4e0b\u4ee3\u7801<\/p>\n
tmpfs \/run\/shm tmpfs defaults,noexec,nosuid 0 0 <\/pre>\n\u4fdd\u5b58\uff0c\u5173\u95ed\u6587\u4ef6\u3002\u4e3a\u4e86\u4f7f\u6539\u53d8\u751f\u6548\uff0c\u9700\u8981\u91cd\u542fUbuntu 16.04.
\n<\/p>\n
2.\u5141\u8bb8\u7279\u5b9a\u7528\u6237\u7684ssh\u767b\u5f55<\/strong><\/div>\n\u5047\u5982\u8bf4\u4f60\u53ea\u60f3\u7528\u6237\u540d\u4e3aolivia\uff0cIP\u5730\u5740\u4e3a192.168.1.152\u7684\u7528\u6237\u901a\u8fc7secure shell\uff0c\u505a\u6cd5\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n
1.\u6253\u5f00\u7ec8\u7aef\u547d\u4ee4\u7a97\u53e3<\/p>\n
2.\u4f7f\u7528\u547d\u4ee4\u6253\u5f00ssh\u914d\u7f6e\u6587\u4ef6<\/p>\n
sudo nano \/etc\/ssh\/sshd_config <\/pre>\n3.\u5728\u6587\u4ef6\u6700\u4e0b\u9762\uff0c\u6dfb\u52a0AllowUsers olivia@192.168.1.152<\/p>\n
4.\u4fdd\u5b58\uff0c\u5173\u95ed\u6587\u4ef6<\/p>\n
5.\u4f7f\u7528\u547d\u4ee4\u91cd\u542fsshd<\/p>\n
sudo service ssh restart <\/pre>\n\u5230\u8fd9\u91cc\uff0csecure shell\u53ea\u4f1a\u8ba9IP\u5730\u5740\u4e3a192.168.1.152\u7684olivia\u83b7\u5f97\u8bbf\u95eeUbuntu\u670d\u52a1\u5668\u7684\u6743\u9650\u3002\u5982\u679c\u5176\u4ed6\u4eba\u5c1d\u8bd5\u4f7f\u7528ssh\u8bbf\u95ee\u670d\u52a1\u5668\uff0c\u4ed6\u4eec\u4f1a\u88ab\u8981\u6c42\u8f93\u5165\u5bc6\u7801\uff0c\u4f46\u662f\u5373\u4f7f\u5bc6\u7801\u6b63\u786e\uff0c\u8bbf\u95eeUbuntu\u670d\u52a1\u5668\u4e5f\u4f1a\u88ab\u62d2\u7edd\u3002<\/p>\n
\u5047\u5982\uff0c\u4f60\u60f3\u8ba9\u4f60\u7684\u7f51\u7edc\u4e0b\u7684\u6240\u6709\u7528\u6237\u90fd\u80fd\u901a\u8fc7ssh\u8bbf\u95ee\u670d\u52a1\u5668\u7684\u8bdd\uff0c\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801<\/p>\n
AllowUsers *@192.168.1.*<\/p>\n
\u91cd\u542fssh\u670d\u52a1\u5668\uff0c\u5c31\u751f\u6548\u4e86\u3002<\/p>\n
3.\u6dfb\u52a0\u4e00\u4e2a\u5b89\u5168\u767b\u5f55banner<\/strong><\/div>\n\u6dfb\u52a0\u4e00\u4e2a\u5b89\u5168\u767b\u5f55bannner\u4f3c\u4e4e\u5bf9\u4f60\u7684\u670d\u52a1\u5668\u5b89\u5168\u6ca1\u6709\u4ec0\u4e48\u4f5c\u7528\uff0c\u4f46\u662f\u5047\u5982\u6709\u4eba\u83b7\u5f97\u8bbf\u95ee\u4f60\u670d\u52a1\u5668\u7684\u6743\u9650\u540e\uff0c\u770b\u5230\u4e86banner\u4e0a\u7684\u8b66\u544a\u4fe1\u606f\uff0c\u53ef\u80fd\u4f1a\u601d\u8003\u518d\u4e09\u8981\u4e0d\u8981\u7ee7\u7eed\u4e0b\u53bb\u3002\u867d\u7136\u8fd9\u662f\u4e00\u79cd\u5fc3\u91cc\u4f5c\u7528\uff0c\u4f46\u662f\u4e5f\u4e0d\u8981\u5c0f\u77a7\u4e86\u5b83\u3002<\/p>\n
\u521b\u5efa\u4e00\u4e2a\u65b0\u7684banner\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n
1.\u6253\u5f00\u7ec8\u7aef\u7a97\u53e3<\/p>\n
2.\u6267\u884c\u547d\u4ee4<\/p>\n
sudo nano \/etc\/issue.net <\/pre>\n3.\u6dfb\u52a0\u5408\u9002\u7684\u8b66\u544a\u4fe1\u606f<\/p>\n
4.\u5173\u95ed\uff0c\u4fdd\u5b58\u6587\u4ef6<\/p>\n
\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u8981\u7981\u6b62motd\u663e\u793abanner\u3002\u9996\u5148\u6253\u5f00\u7ec8\u7aef\u8f93\u5165\u5982\u4e0b\u547d\u4ee4<\/p>\n
sudo nano \/etc\/pam.d\/sshd <\/pre>\n\u52a0\u5165\u4e0b\u9762\u4e24\u884c\uff08\u6bcf\u884c\u524d\u52a0#\uff09<\/p>\n
session optional pam_motd.so motd=\/run\/motd.dynamic \r\nsession optional pam_motd.so noupdate <\/pre>\n\u5728\u6587\u672c\u7f16\u8f91\u5668\u91cc\u6253\u5f00 \/etc\/ssh\/sshd_config\u6587\u4ef6\uff0c\u52a0\u5165<\/p>\n
Banner \/etc\/issue.net <\/pre>\n\u5173\u95ed\uff0c\u4fdd\u5b58\u6587\u4ef6<\/p>\n
\u6700\u540e\uff0c\u4f7f\u7528\u547d\u4ee4\u91cd\u542fssh\u670d\u52a1\u5668<\/p>\n
sudo service ssh restart <\/pre>\n\u8fd9\u65f6\uff0c\u5047\u5982\u6709\u4eba\u901a\u8fc7ssh\u767b\u5f55\u4f60\u7684\u670d\u52a1\u5668\uff0c\u4ed6\u4eec\u5c31\u4f1a\u770b\u5230\u4f60\u65b0\u52a0\u7684banner\uff0c\u8b66\u544a\u4ed6\u4eec\u4f60\u5728\u7559\u610f\u3002<\/p>\n
4.\u589e\u5f3a\u7f51\u7edc\u5c42<\/strong><\/div>\n\u4e3a\u907f\u514d\u4f60\u7684Ubuntu\u670d\u52a1\u5668\u4e0a\u6e90\u8def\u7531\u8f93\u5165\u5305\uff0c\u5e76\u4e14\u6253\u5370\u51fa\u6240\u6709\u7578\u5f62IP\u5730\u5740,\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<\/p>\n
sudo nano \/etc\/sysctl.conf <\/pre>\n\u7136\u540e\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9<\/p>\n
\r\n# IP Spoofing protection \r\nnet.ipv4.conf.all.rp_filter = 1 \r\nnet.ipv4.conf.default.rp_filter = 1 \r\n# Ignore ICMP broadcast requests \r\nnet.ipv4.icmp_echo_ignore_broadcasts = 1 \r\n# Disable source packet routing \r\nnet.ipv4.conf.all.accept_source_route = 0 \r\nnet.ipv6.conf.all.accept_source_route = 0 \r\nnet.ipv4.conf.default.accept_source_route = 0 \r\nnet.ipv6.conf.default.accept_source_route = 0 \r\n# Ignore send redirects \r\nnet.ipv4.conf.all.send_redirects = 0 \r\nnet.ipv4.conf.default.send_redirects = 0 \r\n# Block SYN attacks \r\nnet.ipv4.tcp_syncookies = 1 \r\nnet.ipv4.tcp_max_syn_backlog = 2048 \r\nnet.ipv4.tcp_synack_retries = 2 \r\nnet.ipv4.tcp_syn_retries = 5 \r\n# Log Martians \r\nnet.ipv4.conf.all.log_martians = 1 \r\nnet.ipv4.icmp_ignore_bogus_error_responses = 1 \r\n# Ignore ICMP redirects \r\nnet.ipv4.conf.all.accept_redirects = 0 \r\nnet.ipv6.conf.all.accept_redirects = 0 \r\nnet.ipv4.conf.default.accept_redirects = 0 \r\nnet.ipv6.conf.default.accept_redirects = 0 \r\n# Ignore Directed pings \r\nnet.ipv4.icmp_echo_ignore_all = 1 \r\n<\/pre>\n\u5173\u95ed\uff0c\u4fdd\u5b58\u6587\u4ef6\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u91cd\u542f\u3002<\/p>\n
sudo sysctl -p <\/pre>\n