{"id":353123,"date":"2024-05-20T22:21:48","date_gmt":"2024-05-20T22:21:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=353123"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=353123","title":{"rendered":"<span>VPS cheatsheet<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a, \u0445\u0430\u0431\u0440! \u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u044f \u043a\u0440\u0430\u0442\u043a\u043e \u0440\u0430\u0441\u043f\u0438\u0448\u0443 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e vps \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 pet \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432) \u043d\u0430 ubuntu 22.04. \u041d\u0430 \u0438\u0441\u0442\u0438\u043d\u0443 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u0431\u0443\u0434\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0441\u043e\u0432\u0435\u0442\u0430\u043c\u0438 \u0438 \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u0430\u043c\u0438 \u0438\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432)<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/707\/3e9\/8c7\/7073e98c7e90b8c2088af0fd329d1ea9.jpeg\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/707\/3e9\/8c7\/7073e98c7e90b8c2088af0fd329d1ea9.jpeg\" data-blurred=\"true\"\/><\/figure>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f<\/h3>\n<ol>\n<li>\n<p>\u0412\u0435\u0437\u0434\u0435 \u0433\u0434\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e vim \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c nano, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e vps \u0432\u044b \u0443\u0436\u0435 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0438 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b\u0438, \u0441 \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u043e\u043d\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u043e\u0442 <a href=\"https:\/\/habr.com\/ru\/articles\/725172\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/a><\/p>\n<\/li>\n<\/ol>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h2>\n<h3>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043a\u0443\u043f\u043a\u0438 vps \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u0440\u0443\u0442\u0430 \u0438 ip \u0430\u0434\u0440\u0435\u0441 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0432\u0435\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0438\u0445 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430.<\/p>\n<pre><code class=\"bash\">ssh root@your_ip<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c yes \u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c.<\/p>\n<pre><code class=\"bash\">apt update &amp;&amp; apt dist-upgrade -y &amp;&amp; reboot<\/code><\/pre>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u0430\u043a\u0435\u0442\u0430\u0445, \u0430\u043f\u0433\u0440\u0435\u0439\u0434\u0438\u043c \u0432\u0441\u0435 \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0441\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043d\u043e\u0432\u043e \u0432\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>\u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <code>apt dist-upgrade<\/code>, \u0432\u043c\u0435\u0441\u0442\u043e <code>apt upgrade<\/code> \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u044d\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u0435\u0435, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/askubuntu.com\/a\/226213\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 sudo<\/h3>\n<pre><code class=\"bash\">useradd -m super -G sudo -s \/bin\/bash<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u0438\u043c\u0435\u043d\u0438 super \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u043d\u0430 sudo, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0435\u0439 \u0438 \u0441 bash \u0432 \u0448\u0435\u043b\u043b\u0430.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u043f\u043e\u0434 \u0440\u0443\u0442\u0430 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0438\u0437-\u0437\u0430 \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0439.<\/p>\n<pre><code class=\"bash\">visudo<\/code><\/pre>\n<p>\u041f\u0440\u0430\u0432\u0438\u043c sudo \u043a\u043e\u043d\u0444\u0438\u0433 \u0447\u0435\u0440\u0435\u0437 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0442\u0443\u043b\u0437\u0443, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0432 sudo. \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0449\u0435\u0439:<\/p>\n<p> 1. \u0414\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0433\u0440\u0443\u043f\u043f\u044b sudo \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c sudo \u0431\u0435\u0437 \u0432\u0432\u043e\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f <code>NOPASSWD<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u0438.<\/p>\n<pre><code># Allow members of group sudo to execute any command %sudo   ALL=(ALL:ALL) NOPASSWD:ALL<\/code><\/pre>\n<p> 2.  \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <s>\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c<\/s> \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443.<\/p>\n<pre><code>#includedir \/etc\/sudoers.d<\/code><\/pre>\n<p> 3. \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0435 admin \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c sudo, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044f \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443.<\/p>\n<pre><code># Members of the admin group may gain root privileges #%admin ALL=(ALL) ALL<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \/etc\/sudoers<\/summary>\n<div class=\"spoiler__content\">\n<pre><code># # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in \/etc\/sudoers.d\/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaultsenv_reset Defaultsmail_badpass Defaultssecure_path=\"\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin:\/snap\/bin\"  # Host alias specification  # User alias specification  # Cmnd alias specification  # User privilege specification rootALL=(ALL:ALL) ALL  # Members of the admin group may gain root privileges #%admin ALL=(ALL) ALL  # Allow members of group sudo to execute any command %sudo   ALL=(ALL:ALL) NOPASSWD:ALL  # See sudoers(5) for more information on \"#include\" directives: <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<pre><code class=\"bash\">su super cd<\/code><\/pre>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0432 \u0435\u0433\u043e \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<pre><code class=\"bash\">echo 'umask 0077' >> .bashrc<\/code><\/pre>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u043c\u0430\u0441\u043a\u0443 \u043d\u0430 \u0432\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c.<\/p>\n<pre><code class=\"bash\">mkdir .ssh &amp;&amp; chmod 700 .ssh<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f ssh \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e 700 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.redhat.com\/sysadmin\/linux-file-permissions-explained\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ssh<\/h3>\n<p>\u0414\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c ssh \u043a\u043b\u044e\u0447\u0438, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0430\u0440\u043e\u043b\u0435\u0439. \u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0432\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u043e\u0434\u043d\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u0435.<\/p>\n<pre><code class=\"bash\"># locale ssh-keygen -t rsa -b 4096<\/code><\/pre>\n<p><em>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431:<\/em><\/p>\n<pre><code class=\"bash\"># locale ssh-keygen -t ed25519<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u0436\u0435, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u043a\u043b\u044e\u0447 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>id_ed25519 <\/code>. \u041f\u0440\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/security.stackexchange.com\/a\/101045\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c ssh \u043a\u043b\u044e\u0447\u0438 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435, <strong>\u043d\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435! <\/strong> \u0418 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0432\u0430 \u043a\u043b\u044e\u0447\u0430 \u0432 \u043f\u0430\u043f\u043a\u0435 <code>~\/.ssh\/<\/code>: \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439(\u0443 \u043d\u0435\u0433\u043e \u043d\u0430 \u043a\u043e\u043d\u0446\u0435 <code>.pub<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0433\u0440\u0443\u0437\u0438\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c!<\/p>\n<pre><code class=\"bash\"># locale scp .ssh\/id_rsa.pub root@your_ip:\/home\/super\/.ssh\/<\/code><\/pre>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u043a\u043b\u044e\u0447 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u043f\u0430\u043f\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<pre><code class=\"bash\"># server sudo chown super:super .ssh\/id_rsa.pub &amp;&amp; chmod 600 .ssh\/id_rsa.pub &amp;&amp; mv .ssh\/id_rsa.pub .ssh\/authorized_keys<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0436\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 &#8216;\u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c&#8217; \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043f\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442.\u043a. \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u043b\u0438 \u043c\u044b \u0435\u0433\u043e \u043f\u043e\u0434 \u0440\u0443\u0442\u043e\u043c, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0435\u043c\u0443 \u0438 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432 authorized_key.<\/p>\n<pre><code class=\"bash\"># locale ssh -i .ssh\/id_rsa super@your_ip<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0443\u0434\u0430\u0447\u043d\u043e \u043c\u043e\u0436\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0430 \u043f\u043e\u0434 \u043d\u0430\u0448\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c  \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<pre><code># server sudo vi \/etc\/passwd<\/code><\/pre>\n<p>\u0412\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0447\u0442\u043e\u0431\u044b \u043d\u0438\u043a\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u043f\u043e\u0434 \u043d\u0435\u0433\u043e. \u041c\u0435\u043d\u044f\u0435\u043c \u0435\u0433\u043e shell \u043d\u0430 <code>\/usr\/sbin\/nologin<\/code>, \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/56b\/408\/b4f\/56b408b4fac66776f8cfb3f4833da008.png\" alt=\"\/etc\/passwd\" title=\"\/etc\/passwd\" width=\"724\" height=\"74\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/56b\/408\/b4f\/56b408b4fac66776f8cfb3f4833da008.png\"\/><\/p>\n<div><figcaption>\/etc\/passwd<\/figcaption><\/div>\n<\/figure>\n<pre><code class=\"bash\"># server sudo vi \/etc\/ssh\/sshd_config<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c ssh \u0441\u0435\u0440\u0432\u0435\u0440. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:<\/p>\n<ol>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043f\u043e\u0440\u0442 \u043d\u0430 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439<\/p>\n<\/li>\n<\/ol>\n<pre><code>Port 2220<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u042f\u0432\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0434 root, \u043c\u0435\u043d\u044f\u044f yes \u043d\u0430 no<\/p>\n<\/li>\n<\/ol>\n<pre><code>PermitRootLogin no<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043a\u043b\u044e\u0447\u0443:<\/p>\n<\/li>\n<\/ol>\n<pre><code># To disable tunneled clear text passwords, change to no here! PasswordAuthentication no PermitEmptyPasswords no<\/code><\/pre>\n<ol start=\"4\">\n<li>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e \u043a\u043b\u044e\u0447\u0443<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">PubkeyAuthentication yes<\/code><\/pre>\n<ol start=\"5\">\n<li>\n<p>\u0418\u0437<a href=\"https:\/\/habr.com\/ru\/articles\/756804\/#comment_25896430\" rel=\"noopener noreferrer nofollow\"> <\/a>\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f <a href=\"https:\/\/habr.com\/ru\/users\/aruslantsev\/\" rel=\"noopener noreferrer nofollow\"><\/a><a class=\"mention\" href=\"\/users\/aruslantsev\">@aruslantsev<\/a> <\/p>\n<blockquote>\n<p>\u0415\u0449\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e <code>KbdInteractiveAuthentication no<\/code> \u0438\u043b\u0438 <code>ChallengeResponseAuthentication no<\/code>. \u0418\u043d\u0430\u0447\u0435 \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c: <code>ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no example.com<\/code><\/p>\n<\/blockquote>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434\u0438\u043c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c ssh \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\"># server sudo systemctl restart sshd<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \/etc\/ssh\/sshd_config<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>#$OpenBSD: sshd_config,v 1.103 2018\/04\/09 20:41:22 tj Exp $  # This is the sshd server system-wide configuration file.  See # sshd_config(5) for more information.  # This sshd was compiled with PATH=\/usr\/bin:\/bin:\/usr\/sbin:\/sbin  # The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented.  Uncommented options override the # default value.  Include \/etc\/ssh\/sshd_config.d\/*.conf  Port 2220 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::  #HostKey \/etc\/ssh\/ssh_host_rsa_key #HostKey \/etc\/ssh\/ssh_host_ecdsa_key #HostKey \/etc\/ssh\/ssh_host_ed25519_key  # Ciphers and keying #RekeyLimit default none  # Logging #SyslogFacility AUTH #LogLevel INFO  # Authentication:  #LoginGraceTime 2m PermitRootLogin no #StrictModes yes #MaxAuthTries 6 #MaxSessions 10  PubkeyAuthentication yes  # Expect .ssh\/authorized_keys2 to be disregarded by default in future. #AuthorizedKeysFile.ssh\/authorized_keys .ssh\/authorized_keys2  #AuthorizedPrincipalsFile none  #AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody  # For this to work you will also need host keys in \/etc\/ssh\/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you don't trust ~\/.ssh\/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Don't read the user's ~\/.rhosts and ~\/.shosts files IgnoreRhosts yes  # To disable tunneled clear text passwords, change to no here! PasswordAuthentication no PermitEmptyPasswords no  # Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication no KbdInteractiveAuthentication no  # Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no  # GSSAPI options #GSSAPIAuthentication no #GSSAPICleanupCredentials yes #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no  # Set this to 'yes' to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication.  Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of \"PermitRootLogin without-password\". # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to 'no'. UsePAM yes  #AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes PrintMotd no #PrintLastLog yes #TCPKeepAlive yes #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 #ClientAliveCountMax 3 #UseDNS no #PidFile \/var\/run\/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none  # no default banner path Banner \/etc\/ssh\/banner  # Allow client to pass locale environment variables AcceptEnv LANG LC_*  # override default of no subsystems Subsystemsftp\/usr\/lib\/openssh\/sftp-server  # Example of overriding settings on a per-user basis #Match User anoncvs #X11Forwarding no #AllowTcpForwarding no #PermitTTY no #ForceCommand cvs server<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<pre><code class=\"css\"># locale vi .ssh\/config<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c ssh config, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c ip \u0430\u0434\u0440\u0435\u0441, \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<pre><code>Host pet   # \u041c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u0441\u0432\u043e\u0439 ip   HostName your_ip   # \u041c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f   User super   IdentitiesOnly yes   IdentityFile ~\/.ssh\/id_rsa   # \u041c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u0441\u0432\u043e\u0439 \u043f\u043e\u0440\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438 \u043f\u043e\u0440\u0442, \u0442\u043e \u0441\u0442\u0430\u0432\u0438\u043c 22   Port 2220 <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">ssh pet<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0434\u043e\u043f. \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c<\/h3>\n<pre><code>sudo apt install git ufw nmap net-tools curl<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0442\u0443\u043b\u0437\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<ol>\n<li>\n<p>ufw &#8212; \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430\u0434 <code>iptables<\/code>, \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u043b\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>git &#8212; \u0447\u0430\u0441\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043b\u0438\u0448\u043d\u0438\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>nmap &#8212; \u0434\u043b\u044f &#8216;\u043f\u0440\u043e\u0441\u0442\u0443\u043a\u0438\u0432\u0430\u043d\u0438\u044f&#8217; \u043f\u043e\u0440\u0442\u043e\u0432, \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043b\u0438\u0448\u043d\u0438\u0435 \u043f\u043e\u0440\u0442\u044b \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>net-tools &#8212; \u0441\u044e\u0434\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 <code>ifconfig<\/code> \u0438 <code>netstat<\/code>, \u0447\u0430\u0441\u0442\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p>curl &#8212; \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f http \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>(\u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d \u0434\u043e\u043a\u0435\u0440, \u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/#install-using-the-repository\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435c\u044c<\/a><\/p>\n<h2>Firewall<\/h2>\n<pre><code class=\"bash\"># \u0415\u0441\u043b\u0438 \u043c\u0435\u043d\u044f\u043b\u0438 \u043f\u043e\u0440\u0442 ssh sudo ufw allow 2220\/tcp  # \u0415\u0441\u043b\u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438 sudo ufw allow ssh<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e ssh.<\/p>\n<pre><code class=\"bash\">sudo ufw default deny incoming sudo ufw default allow outgoing<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0435 \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0438\u0435.<\/p>\n<pre><code class=\"bash\">sudo ufw enable<\/code><\/pre>\n<p>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c firewall.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430, \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0433 \ud83d\ude42<\/p>\n<h2>\u0418\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432<\/h2>\n<h3>Fail2ban<\/h3>\n<blockquote>\n<p><a href=\"https:\/\/habr.com\/ru\/users\/aborouhin\/\" rel=\"noopener noreferrer nofollow\">@aborouhin <\/a> \u0420\u0430\u0437 \u0443\u0436 \u043c\u044b \u043f\u0440\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c &#8212; \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 fail2ban.<\/p>\n<\/blockquote>\n<p>\u0412\u043e\u0442 <a href=\"https:\/\/linuxize.com\/post\/install-configure-fail2ban-on-ubuntu-20-04\/\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 fail2ban \u043d\u0430 ssh. \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e \u043e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0430\u043d\u0438\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441 ip \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u0438 \u043e\u043f\u0435\u0440\u0435\u0434\u0435\u043b\u043d\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u0440\u043e\u0442\u0438\u0432 \u0431\u043e\u0442\u043e\u0432.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/756804\/\"> https:\/\/habr.com\/ru\/articles\/756804\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a, \u0445\u0430\u0431\u0440! \u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u044f \u043a\u0440\u0430\u0442\u043a\u043e \u0440\u0430\u0441\u043f\u0438\u0448\u0443 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e vps \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 pet \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432) \u043d\u0430 ubuntu 22.04. \u041d\u0430 \u0438\u0441\u0442\u0438\u043d\u0443 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u0431\u0443\u0434\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0441\u043e\u0432\u0435\u0442\u0430\u043c\u0438 \u0438 \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u0430\u043c\u0438 \u0438\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432)<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f<\/h3>\n<ol>\n<li>\n<p>\u0412\u0435\u0437\u0434\u0435 \u0433\u0434\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e vim \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c nano, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e vps \u0432\u044b \u0443\u0436\u0435 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0438 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b\u0438, \u0441 \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u043e\u043d\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u043e\u0442 <a href=\"https:\/\/habr.com\/ru\/articles\/725172\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/a><\/p>\n<\/li>\n<\/ol>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h2>\n<h3>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043a\u0443\u043f\u043a\u0438 vps \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u0440\u0443\u0442\u0430 \u0438 ip \u0430\u0434\u0440\u0435\u0441 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0432\u0435\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0438\u0445 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430.<\/p>\n<pre><code class=\"bash\">ssh root@your_ip<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c yes \u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c.<\/p>\n<pre><code class=\"bash\">apt update &amp;&amp; apt dist-upgrade -y &amp;&amp; reboot<\/code><\/pre>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u0430\u043a\u0435\u0442\u0430\u0445, \u0430\u043f\u0433\u0440\u0435\u0439\u0434\u0438\u043c \u0432\u0441\u0435 \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0441\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043d\u043e\u0432\u043e \u0432\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>\u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <code>apt dist-upgrade<\/code>, \u0432\u043c\u0435\u0441\u0442\u043e <code>apt upgrade<\/code> \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u044d\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u0435\u0435, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/askubuntu.com\/a\/226213\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 sudo<\/h3>\n<pre><code class=\"bash\">useradd -m super -G sudo -s \/bin\/bash<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u0438\u043c\u0435\u043d\u0438 super \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u043d\u0430 sudo, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0435\u0439 \u0438 \u0441 bash \u0432 \u0448\u0435\u043b\u043b\u0430.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u043f\u043e\u0434 \u0440\u0443\u0442\u0430 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0438\u0437-\u0437\u0430 \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0439.<\/p>\n<pre><code class=\"bash\">visudo<\/code><\/pre>\n<p>\u041f\u0440\u0430\u0432\u0438\u043c sudo \u043a\u043e\u043d\u0444\u0438\u0433 \u0447\u0435\u0440\u0435\u0437 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0442\u0443\u043b\u0437\u0443, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0432 sudo. \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0449\u0435\u0439:<\/p>\n<p> 1. \u0414\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0433\u0440\u0443\u043f\u043f\u044b sudo \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c sudo \u0431\u0435\u0437 \u0432\u0432\u043e\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f <code>NOPASSWD<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u0438.<\/p>\n<pre><code># Allow members of group sudo to execute any command %sudo   ALL=(ALL:ALL) NOPASSWD:ALL<\/code><\/pre>\n<p> 2.  \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <s>\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c<\/s> \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443.<\/p>\n<pre><code>#includedir \/etc\/sudoers.d<\/code><\/pre>\n<p> 3. \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0435 admin \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c sudo, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044f \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443.<\/p>\n<pre><code># Members of the admin group may gain root privileges #%admin ALL=(ALL) ALL<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \/etc\/sudoers<\/summary>\n<div class=\"spoiler__content\">\n<pre><code># # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in \/etc\/sudoers.d\/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaultsenv_reset Defaultsmail_badpass Defaultssecure_path=\"\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin:\/snap\/bin\"  # Host alias specification  # User alias specification  # Cmnd alias specification  # User privilege specification rootALL=(ALL:ALL) ALL  # Members of the admin group may gain root privileges #%admin ALL=(ALL) ALL  # Allow members of group sudo to execute any command %sudo   ALL=(ALL:ALL) NOPASSWD:ALL  # See sudoers(5) for more information on \"#include\" directives: <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<pre><code class=\"bash\">su super cd<\/code><\/pre>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0432 \u0435\u0433\u043e \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<pre><code class=\"bash\">echo 'umask 0077' >> .bashrc<\/code><\/pre>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u043c\u0430\u0441\u043a\u0443 \u043d\u0430 \u0432\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c.<\/p>\n<pre><code class=\"bash\">mkdir .ssh &amp;&amp; chmod 700 .ssh<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f ssh \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e 700 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.redhat.com\/sysadmin\/linux-file-permissions-explained\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ssh<\/h3>\n<p>\u0414\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c ssh \u043a\u043b\u044e\u0447\u0438, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0430\u0440\u043e\u043b\u0435\u0439. \u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0432\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u043e\u0434\u043d\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u0435.<\/p>\n<pre><code class=\"bash\"># locale ssh-keygen -t rsa -b 4096<\/code><\/pre>\n<p><em>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431:<\/em><\/p>\n<pre><code class=\"bash\"># locale ssh-keygen -t ed25519<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u0436\u0435, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u043a\u043b\u044e\u0447 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>id_ed25519 <\/code>. \u041f\u0440\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/security.stackexchange.com\/a\/101045\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c ssh \u043a\u043b\u044e\u0447\u0438 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435, <strong>\u043d\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435! <\/strong> \u0418 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0432\u0430 \u043a\u043b\u044e\u0447\u0430 \u0432 \u043f\u0430\u043f\u043a\u0435 <code>~\/.ssh\/<\/code>: \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439(\u0443 \u043d\u0435\u0433\u043e \u043d\u0430 \u043a\u043e\u043d\u0446\u0435 <code>.pub<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0433\u0440\u0443\u0437\u0438\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c!<\/p>\n<pre><code class=\"bash\"># locale scp .ssh\/id_rsa.pub root@your_ip:\/home\/super\/.ssh\/<\/code><\/pre>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u043a\u043b\u044e\u0447 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u043f\u0430\u043f\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<pre><code class=\"bash\"># server sudo chown super:super .ssh\/id_rsa.pub &amp;&amp; chmod 600 .ssh\/id_rsa.pub &amp;&amp; mv .ssh\/id_rsa.pub .ssh\/authorized_keys<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0436\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 &#8216;\u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c&#8217; \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043f\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442.\u043a. \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u043b\u0438 \u043c\u044b \u0435\u0433\u043e \u043f\u043e\u0434 \u0440\u0443\u0442\u043e\u043c, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0435\u043c\u0443 \u0438 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432 authorized_key.<\/p>\n<pre><code class=\"bash\"># locale ssh -i .ssh\/id_rsa super@your_ip<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0443\u0434\u0430\u0447\u043d\u043e \u043c\u043e\u0436\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0430 \u043f\u043e\u0434 \u043d\u0430\u0448\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c  \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<pre><code># server sudo vi \/etc\/passwd<\/code><\/pre>\n<p>\u0412\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0447\u0442\u043e\u0431\u044b \u043d\u0438\u043a\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u043f\u043e\u0434 \u043d\u0435\u0433\u043e. \u041c\u0435\u043d\u044f\u0435\u043c \u0435\u0433\u043e shell \u043d\u0430 <code>\/usr\/sbin\/nologin<\/code>, \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\/etc\/passwd<\/figcaption><\/div>\n<\/figure>\n<pre><code class=\"bash\"># server sudo vi \/etc\/ssh\/sshd_config<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c ssh \u0441\u0435\u0440\u0432\u0435\u0440. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:<\/p>\n<ol>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043f\u043e\u0440\u0442 \u043d\u0430 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439<\/p>\n<\/li>\n<\/ol>\n<pre><code>Port 2220<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u042f\u0432\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0434 root, \u043c\u0435\u043d\u044f\u044f yes \u043d\u0430 no<\/p>\n<\/li>\n<\/ol>\n<pre><code>PermitRootLogin no<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043a\u043b\u044e\u0447\u0443:<\/p>\n<\/li>\n<\/ol>\n<pre><code># To disable tunneled clear text passwords, change to no here! PasswordAuthentication no PermitEmptyPasswords no<\/code><\/pre>\n<ol start=\"4\">\n<li>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e \u043a\u043b\u044e\u0447\u0443<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">PubkeyAuthentication yes<\/code><\/pre>\n<ol start=\"5\">\n<li>\n<p>\u0418\u0437<a href=\"https:\/\/habr.com\/ru\/articles\/756804\/#comment_25896430\" rel=\"noopener noreferrer nofollow\"> <\/a>\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f <a href=\"https:\/\/habr.com\/ru\/users\/aruslantsev\/\" rel=\"noopener noreferrer nofollow\"><\/a><a class=\"mention\" href=\"\/users\/aruslantsev\">@aruslantsev<\/a> <\/p>\n<blockquote>\n<p>\u0415\u0449\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e <code>KbdInteractiveAuthentication no<\/code> \u0438\u043b\u0438 <code>ChallengeResponseAuthentication no<\/code>. \u0418\u043d\u0430\u0447\u0435 \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c: <code>ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no example.com<\/code><\/p>\n<\/blockquote>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434\u0438\u043c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c ssh \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\"># server sudo systemctl restart sshd<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \/etc\/ssh\/sshd_config<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>#$OpenBSD: sshd_config,v 1.103 2018\/04\/09 20:41:22 tj Exp $  # This is the sshd server system-wide configuration file.  See # sshd_config(5) for more information.  # This sshd was compiled with PATH=\/usr\/bin:\/bin:\/usr\/sbin:\/sbin  # The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented.  Uncommented options override the # default value.  Include \/etc\/ssh\/sshd_config.d\/*.conf  Port 2220 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::  #HostKey \/etc\/ssh\/ssh_host_rsa_key #HostKey \/etc\/ssh\/ssh_host_ecdsa_key #HostKey \/etc\/ssh\/ssh_host_ed25519_key  # Ciphers and keying #RekeyLimit default none  # Logging #SyslogFacility AUTH #LogLevel INFO  # Authentication:  #LoginGraceTime 2m PermitRootLogin no #StrictModes yes #MaxAuthTries 6 #MaxSessions 10  PubkeyAuthentication yes  # Expect .ssh\/authorized_keys2 to be disregarded by default in future. #AuthorizedKeysFile.ssh\/authorized_keys .ssh\/authorized_keys2  #AuthorizedPrincipalsFile none  #AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody  # For this to work you will also need host keys in \/etc\/ssh\/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you don't trust ~\/.ssh\/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Don't read the user's ~\/.rhosts and ~\/.shosts files IgnoreRhosts yes  # To disable tunneled clear text passwords, change to no here! PasswordAuthentication no PermitEmptyPasswords no  # Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication no KbdInteractiveAuthentication no  # Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no  # GSSAPI options #GSSAPIAuthentication no #GSSAPICleanupCredentials yes #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no  # Set this to 'yes' to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication.  Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of \"PermitRootLogin without-password\". # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to 'no'. UsePAM yes  #AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes PrintMotd no #PrintLastLog yes #TCPKeepAlive yes #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 #ClientAliveCountMax 3 #UseDNS no #PidFile \/var\/run\/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none  # no default banner path Banner \/etc\/ssh\/banner  # Allow client to pass locale environment variables AcceptEnv LANG LC_*  # override default of no subsystems Subsystemsftp\/usr\/lib\/openssh\/sftp-server  # Example of overriding settings on a per-user basis #Match User anoncvs #X11Forwarding no #AllowTcpForwarding no #PermitTTY no #ForceCommand cvs server<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<pre><code class=\"css\"># locale vi .ssh\/config<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c ssh config, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c ip \u0430\u0434\u0440\u0435\u0441, \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<pre><code>Host pet   # \u041c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u0441\u0432\u043e\u0439 ip   HostName your_ip   # \u041c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f   User super   IdentitiesOnly yes   IdentityFile ~\/.ssh\/id_rsa   # \u041c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u0441\u0432\u043e\u0439 \u043f\u043e\u0440\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438 \u043f\u043e\u0440\u0442, \u0442\u043e \u0441\u0442\u0430\u0432\u0438\u043c 22   Port 2220 <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">ssh pet<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0434\u043e\u043f. \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c<\/h3>\n<pre><code>sudo apt install git ufw nmap net-tools curl<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0442\u0443\u043b\u0437\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<ol>\n<li>\n<p>ufw &#8212; \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430\u0434 <code>iptables<\/code>, \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u043b\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>git &#8212; \u0447\u0430\u0441\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043b\u0438\u0448\u043d\u0438\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>nmap &#8212; \u0434\u043b\u044f &#8216;\u043f\u0440\u043e\u0441\u0442\u0443\u043a\u0438\u0432\u0430\u043d\u0438\u044f&#8217; \u043f\u043e\u0440\u0442\u043e\u0432, \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043b\u0438\u0448\u043d\u0438\u0435 \u043f\u043e\u0440\u0442\u044b \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>net-tools &#8212; \u0441\u044e\u0434\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 <code>ifconfig<\/code> \u0438 <code>netstat<\/code>, \u0447\u0430\u0441\u0442\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p>curl &#8212; \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f http \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>(\u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d \u0434\u043e\u043a\u0435\u0440, \u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/#install-using-the-repository\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435c\u044c<\/a><\/p>\n<h2>Firewall<\/h2>\n<pre><code class=\"bash\"># \u0415\u0441\u043b\u0438 \u043c\u0435\u043d\u044f\u043b\u0438 \u043f\u043e\u0440\u0442 ssh sudo ufw allow 2220\/tcp  # \u0415\u0441\u043b\u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438 sudo ufw allow ssh<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e ssh.<\/p>\n<pre><code class=\"bash\">sudo ufw default deny incoming sudo ufw default allow outgoing<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0435 \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0438\u0435.<\/p>\n<pre><code class=\"bash\">sudo ufw enable<\/code><\/pre>\n<p>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c firewall.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 <\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-353123","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=353123"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353123\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}