{"id":1114,"date":"2019-05-24T17:39:48","date_gmt":"2019-05-24T14:39:48","guid":{"rendered":"https:\/\/artem.services\/?p=1114"},"modified":"2019-05-24T17:40:31","modified_gmt":"2019-05-24T14:40:31","slug":"amazon-linux-2-ami-sftp-%d0%b4%d0%be%d1%81%d1%82%d1%83%d0%bf","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=1114","title":{"rendered":"Amazon Linux 2 AMI &#8212; SFTP \u0434\u043e\u0441\u0442\u0443\u043f"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-214\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo.png\" alt=\"\" width=\"975\" height=\"450\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo.png 975w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo-300x138.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo-768x354.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo-954x440.png 954w\" sizes=\"(max-width: 975px) 100vw, 975px\" \/><\/p>\n<p>\u0412\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0442\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f <strong>CentOS<\/strong> \u0441\u0438\u0441\u0442\u0435\u043c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0447\u0435\u0440\u0435\u0437 <strong>SFTP<\/strong> \u043f\u043e <strong>SSH<\/strong> \u043a\u043b\u044e\u0447\u0443 \u0432 \u0432\u0435\u0431 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c <strong>Apache<\/strong>. \u0415\u0441\u0442\u044c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f \u0434\u043b\u044f <strong>Apache<\/strong> \u0433\u0440\u0443\u043f\u043f\u0430 &quot;<strong>apache<\/strong>&quot;, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u043d\u0430 \u043d\u0443\u0436\u043d\u0443\u044e.<\/p>\n<p>\u0412\u0441\u0435 \u0441\u0430\u0439\u0442\u044b \u0436\u0438\u0432\u0443\u0442 \u043f\u043e \u043f\u0443\u0442\u0438:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\/var\/www\/html\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <strong>sftpuser<\/strong> (\u0443\u0436\u0435 \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nuseradd -g apache -d \/var\/www\/html -s \/sbin\/nologin sftpuser\r\n<\/pre>\n<p>\u0414\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0430 \u0433\u0440\u0443\u043f\u043f\u0435 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nchmod -R g+w \/var\/www\/html\/*\r\n<\/pre>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nchown -R sftpuser:apache \/var\/www\/html\/*\r\n<\/pre>\n<p>&nbsp;<\/p>\n<blockquote><p>\u0421\u0430\u043c\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f &quot;<strong>html<\/strong>&quot; \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e &quot;<strong>sftpuser<\/strong>&quot;<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0437\u0430\u0434\u0430\u0435\u043c \u0435\u0439 \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmkdir \/var\/www\/html\/.ssh\r\nchmod 700 \/var\/www\/html\/.ssh\r\n<\/pre>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u043d\u0438\u0445 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 <strong>SSH<\/strong> \u043a\u043b\u044e\u0447:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nauthorized_keys\r\nid_rsa.pub\r\n<\/pre>\n<p>\u0417\u0430\u0434\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nchmod 644 \/var\/www\/html\/.ssh\/*\r\n<\/pre>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c <strong>sftpuser<\/strong> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nchown -R sftpuser:apache \/var\/www\/html\/.ssh\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a <strong>SSH<\/strong> \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nvim \/etc\/ssh\/sshd_config\r\n<\/pre>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nSubsystem sftp\t\/usr\/libexec\/openssh\/sftp-server\r\n<\/pre>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nSubsystem sftp\tinternal-sftp\r\n<\/pre>\n<p>\u0418 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nMatch Group apache\r\nX11Forwarding no\r\nAllowTcpForwarding no\r\nChrootDirectory %h\r\nForceCommand internal-sftp\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u043b\u0443\u0436\u0431\u0443 <strong>SSH<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nservice restart sshd\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <strong>SFTP<\/strong> \u043a\u043b\u0438\u0435\u043d\u0442 \u0443\u043a\u0430\u0437\u0430\u0432 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f &quot;<strong>sftpuser<\/strong>&quot; \u0438 \u043f\u0443\u0442\u044c \u043a \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u043c\u0443 <strong>SSH<\/strong> \u043a\u043b\u044e\u0447\u0443, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439, \u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f &#8212; SSH \u043f\u043e\u0440\u0442 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <strong>22<\/strong>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0442\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f CentOS \u0441\u0438\u0441\u0442\u0435\u043c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0447\u0435\u0440\u0435\u0437 SFTP \u043f\u043e SSH \u043a\u043b\u044e\u0447\u0443 \u0432 \u0432\u0435\u0431 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c Apache. \u0415\u0441\u0442\u044c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f \u0434\u043b\u044f Apache \u0433\u0440\u0443\u043f\u043f\u0430 &quot;apache&quot;, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u043d\u0430 \u043d\u0443\u0436\u043d\u0443\u044e. \u0412\u0441\u0435 \u0441\u0430\u0439\u0442\u044b \u0436\u0438\u0432\u0443\u0442 \u043f\u043e \u043f\u0443\u0442\u0438: &nbsp; \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f sftpuser (\u0443\u0436\u0435 \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443): \u0414\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0430 \u0433\u0440\u0443\u043f\u043f\u0435 &hellip; <a href=\"https:\/\/artem.services\/?p=1114\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c<span class=\"screen-reader-text\"> &quot;Amazon Linux 2 AMI &#8212; SFTP \u0434\u043e\u0441\u0442\u0443\u043f&quot;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[25,5,847,849,851],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1114"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1114"}],"version-history":[{"count":2,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1114\/revisions"}],"predecessor-version":[{"id":1116,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1114\/revisions\/1116"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}