{"id":1644,"date":"2018-02-26T22:52:22","date_gmt":"2018-02-26T22:52:22","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=1644"},"modified":"2018-12-18T23:12:18","modified_gmt":"2018-12-18T23:12:18","slug":"setup-secure-ftp-server-on-centos","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/setup-secure-ftp-server-on-centos\/","title":{"rendered":"Setup Secure FTP server on CentOS"},"content":{"rendered":"<p><strong>Setup SFTP Server<\/strong><\/p>\n<p>When finished you&#8217;ll have a SFTP server setup that is configured so the users are in a chroot environment, and can not ssh, or telnet to the server.<\/p>\n<p>Install SSH server if it is not already<\/p>\n<pre>yum install openssh-server openssh-client<\/pre>\n<p>Create group that is limited to sftp so they can&#8217;t ssh, scp etc.<\/p>\n<pre>groupadd sftpusers<\/pre>\n<p>Add chroot settings to \/etc\/ssh\/sshd_config.\u00a0 The %u is a variable, which is the users username.<\/p>\n<pre>Match Group sftpusers\nChrootDirectory \/sftp\/%u\nForceCommand internal-sftp<\/pre>\n<p>Make ftp directory<\/p>\n<pre>mkdir \/sftp<\/pre>\n<p>Add SFTP user<\/p>\n<pre>useradd -g sftpusers -d \/sftp -s \/sbin\/nologin newsftpuser<\/pre>\n<p>Create password for new user<\/p>\n<pre>passwd newsftpuser<\/pre>\n<p>Create directory for user<\/p>\n<pre>mkdir \/sftp\/newsftpuser<\/pre>\n<p>Create directory to put ftp files<\/p>\n<pre>mkdir \/sftp\/newsftpuser\/files<\/pre>\n<p>Change permissions<\/p>\n<pre>chown newsftpuser:sftpusers \/sftp\/newsftpuser\/files\/<\/pre>\n<p>Restart sshd<\/p>\n<pre>systemctl restart sshd<\/pre>\n<p>Should be good to go.\u00a0 Test it by logging in with your favorite FTP client.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setup SFTP Server When finished you&#8217;ll have a SFTP server setup that is configured so the users are in a chroot environment, and can not ssh, or telnet to the server. Install SSH server if it is not already yum &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/setup-secure-ftp-server-on-centos\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,4,3],"tags":[17,342,344,7,343,341,221],"class_list":["post-1644","post","type-post","status-publish","format-standard","hentry","category-centos-linux","category-command-line","category-linux","tag-centos","tag-ftp","tag-internal-sftp","tag-linux-2","tag-secure-ftp","tag-sftp","tag-ssh"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1644","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=1644"}],"version-history":[{"count":5,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1644\/revisions"}],"predecessor-version":[{"id":2231,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1644\/revisions\/2231"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=1644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=1644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=1644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}