{"id":906,"date":"2026-09-17T23:32:40","date_gmt":"2026-09-17T20:32:40","guid":{"rendered":"https:\/\/imaxis.ru\/?p=906"},"modified":"2026-09-18T00:06:10","modified_gmt":"2026-09-17T21:06:10","slug":"kak-razreshit-root-vhod-po-ssh-v-linux-po-klyuchu-i-po-parolyu","status":"publish","type":"post","link":"https:\/\/imaxis.ru\/?p=906","title":{"rendered":"\u041a\u0430\u043a \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c root-\u0432\u0445\u043e\u0434 \u043f\u043e SSH \u0432 Linux (\u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438 \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e)"},"content":{"rendered":"<h1>\u041a\u0430\u043a \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c root-\u0432\u0445\u043e\u0434 \u043f\u043e SSH \u0432 Linux (\u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438 \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e)<\/h1>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 Debian\/Ubuntu, Rocky \u0438 \u043f\u043e\u0437\u0434\u043d\u0438\u0445 CentOS \u0432\u0445\u043e\u0434 <code>root<\/code> \u043f\u043e SSH \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d: \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u2014 <code>access denied<\/code> \u0438\u043b\u0438 <code>permission denied<\/code>. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u0415\u0441\u043b\u0438 \u0432\u0445\u043e\u0434 <code>root<\/code> \u043d\u0443\u0436\u0435\u043d, \u043d\u0438\u0436\u0435 \u2014 \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430.<\/p>\n<p><strong>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 UNIX-\u0441\u0438\u0441\u0442\u0435\u043c.<\/strong><\/p>\n<hr \/>\n<h2>\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0439\u0442\u0438 \u043f\u043e\u0434 <code>root<\/code> \u043f\u043e \u043a\u043b\u044e\u0447\u0443. \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043f\u043e\u0440\u044f\u0434\u043e\u043a.<\/p>\n<p>\u041d\u0430 \u043b\u044e\u0431\u043e\u043c Linux-\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439:<\/p>\n<pre><code class=\"language-bash\">ssh-keygen -t ed25519\n<\/code><\/pre>\n<p>\u0412 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"language-bash\">ls -l ~\/.ssh\/\n<\/code><\/pre>\n<p><strong><code>id_ed25519.pub<\/code> (\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439) \u0438 <code>id_ed25519<\/code> (\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439).<\/strong><\/p>\n<pre><code class=\"language-bash\">cat ~\/.ssh\/id_ed25519.pub\n<\/code><\/pre>\n<p><strong>\u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435.<\/strong><\/p>\n<p>\u041d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre><code class=\"language-bash\">mkdir -p \/root\/.ssh\nvi \/root\/.ssh\/authorized_keys\n<\/code><\/pre>\n<p><strong>\u0412\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>id_ed25519.pub<\/code>.<\/strong><\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f:<\/p>\n<pre><code class=\"language-bash\">ssh root@&lt;IP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430&gt;\n<\/code><\/pre>\n<p><strong>\u0412\u0445\u043e\u0434 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0431\u0435\u0437 \u043f\u0430\u0440\u043e\u043b\u044f. \u0414\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043b\u0443\u0447\u0448\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435.<\/strong><\/p>\n<hr \/>\n<h2>\u041f\u043e \u043f\u0430\u0440\u043e\u043b\u044e<\/h2>\n<p>\u0417\u0430\u0434\u0430\u0451\u043c \u043f\u0430\u0440\u043e\u043b\u044c <code>root<\/code>:<\/p>\n<pre><code class=\"language-bash\">passwd root\n<\/code><\/pre>\n<p><strong>\u0412\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u0432\u0430\u0436\u0434\u044b.<\/strong><\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e SSH-\u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"language-bash\">vi \/etc\/ssh\/sshd_config\n<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>PermitRootLogin<\/code> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a:<\/p>\n<pre><code>PermitRootLogin yes\n<\/code><\/pre>\n<p><strong>\u0415\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u2014 \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435.<\/strong><\/p>\n<p><strong>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <code>without-password<\/code> \u0438\u043b\u0438 <code>prohibit-password<\/code> \u2014 \u043e\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0432\u0445\u043e\u0434 root \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 GSSAPI (\u043d\u0435 \u043f\u0430\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438): \u0441\u043c\u0430\u0440\u0442-\u043a\u0430\u0440\u0442\u0430, \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043f\u0430\u043b\u044c\u0446\u0430 \u0438 \u0442. \u043f.<\/strong><\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c SSH-\u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<pre><code class=\"language-bash\">systemctl restart ssh || systemctl restart sshd\n<\/code><\/pre>\n<p><strong>\u0412 \u0441\u0442\u0430\u0440\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0431\u0435\u0437 systemd:<\/strong><\/p>\n<pre><code class=\"language-bash\">service ssh restart || service sshd restart\n<\/code><\/pre>\n<p><strong>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f.<\/strong><\/p>\n<hr \/>\n<h2>\u0422\u043e\u043d\u043a\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438<\/h2>\n<ul>\n<li><strong>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/strong> \u2014 \u0432\u0445\u043e\u0434 <code>root<\/code> \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0440\u0438\u0441\u043a \u043f\u043e\u0434\u0431\u043e\u0440\u0430; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043b\u044e\u0447\u0438 \u0438 <code>fail2ban<\/code>.<\/li>\n<li><strong><code>prohibit-password<\/code><\/strong> \u2014 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0434\u0435\u0444\u043e\u043b\u0442: \u0432\u0445\u043e\u0434 root \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043a\u043b\u044e\u0447\u0443\/GSSAPI, \u043d\u043e \u043d\u0435 \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e.<\/li>\n<li><strong><code>PermitRootLogin<\/code> vs <code>AllowUsers<\/code><\/strong> \u2014 \u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u043d <code>AllowUsers<\/code>, <code>root<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435, \u0438\u043d\u0430\u0447\u0435 \u0432\u0445\u043e\u0434 \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 <code>PermitRootLogin<\/code>.<\/li>\n<li><strong><code>PasswordAuthentication no<\/code><\/strong> \u2014 \u043f\u0440\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u043e\u0439 \u043f\u0430\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <code>PermitRootLogin yes<\/code> \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442.<\/li>\n<li><strong>SELinux (RPM)<\/strong> \u2014 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 <code>~\/.ssh\/authorized_keys<\/code> (<code>restorecon<\/code>).<\/li>\n<li><strong>\u041f\u0440\u0430\u0432\u0430<\/strong> \u2014 <code>authorized_keys<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c <code>root<\/code>, \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>.ssh<\/code> \u2014 \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 <code>700<\/code>, \u0444\u0430\u0439\u043b \u2014 <code>600<\/code>.<\/li>\n<li><strong>\u041b\u0443\u0447\u0448\u0435 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c<\/strong> \u2014 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441 <code>sudo<\/code> \u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438.<\/li>\n<\/ul>\n<hr \/>\n<h2>\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430<\/h2>\n<pre><code class=\"language-bash\"># \u043f\u043e \u043a\u043b\u044e\u0447\u0443\nssh-keygen -t ed25519\nmkdir -p \/root\/.ssh &amp;&amp; vi \/root\/.ssh\/authorized_keys   # \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c id_ed25519.pub\n\n# \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e\npasswd root\nvi \/etc\/ssh\/sshd_config     # PermitRootLogin yes\nsystemctl restart ssh || systemctl restart sshd\n<\/code><\/pre>\n<p><em>\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e \u043d\u0430: Ubuntu 22.04\/24.04\/26.04, Debian 12, Rocky Linux 9.<\/em><br \/>\n<em>\u0414\u0430\u0442\u0430: \u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c 2026.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c root-\u0432\u0445\u043e\u0434 \u043f\u043e SSH \u0432 Linux (\u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-906","post","type-post","status-publish","format-standard","hentry","category-linux"],"aioseo_notices":[],"views":11,"_links":{"self":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=906"}],"version-history":[{"count":2,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/906\/revisions"}],"predecessor-version":[{"id":909,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/906\/revisions\/909"}],"wp:attachment":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}