{"id":16,"date":"2021-08-15T19:26:50","date_gmt":"2021-08-15T13:26:50","guid":{"rendered":"https:\/\/bytegeeks.net\/blog\/?p=16"},"modified":"2021-08-16T17:40:32","modified_gmt":"2021-08-16T11:40:32","slug":"ftp-server-on-a-raspberry-pi","status":"publish","type":"post","link":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/","title":{"rendered":"FTP server on a Raspberry Pi"},"content":{"rendered":"\n<p>I have a raspberrypi4 8GB variant, that is running as my network wide Ads blocker <a href=\"https:\/\/pi-hole.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">pi-hole<\/a>, my home phone system <a href=\"https:\/\/www.3cx.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">3cx<\/a> and a few test websites on <a href=\"https:\/\/www.nginx.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">nginx<\/a>. Yet this raspberrypi4 has a lot more to offer. So why not run an FTP server on a raspberrypi4 to backup all my public sites (of course I backup those ftp downloads to another storage).<\/p>\n\n\n\n<p>Follow this step by step guide to setup your own FTP server  on a raspberrypi4 or on any linux system for that matter.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Prerequisites &#8211;<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li>Have a raspberrypi (DUH!)<\/li><li>Have a second computer to test your FTP server \ud83d\ude1b<\/li><\/ol>\n\n\n\n<div class=\"schema-how-to wp-block-yoast-how-to-block\"><p class=\"schema-how-to-total-time\"><span class=\"schema-how-to-duration-time-text\">Time needed:&nbsp;<\/span>10 minutes<\/p><p class=\"schema-how-to-description\"><strong>Steps to follow<\/strong><\/p> <ol class=\"schema-how-to-steps\"><li class=\"schema-how-to-step\" id=\"how-to-step-1628524891396\"><strong class=\"schema-how-to-step-name\">Make sure your system is updated<\/strong> <p class=\"schema-how-to-step-text\"><code>sudo apt update<\/code><br\/><code>sudo apt full-upgrade<\/code><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1628525186581\"><strong class=\"schema-how-to-step-name\">Install the FTP server<\/strong> <p class=\"schema-how-to-step-text\"><code>sudo apt install vsftpd<\/code><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1628525434472\"><strong class=\"schema-how-to-step-name\">Edit the configuration file<\/strong> <p class=\"schema-how-to-step-text\">A few lines need to be edited to achieve our goal. Find the following lines in the configuration file. (Use Ctrl + W to quick search). Change the values of the following lines accordingly.<br\/><br\/><strong>Open<\/strong> the configuration file <code>sudo nano \/etc\/vsftpd.conf<\/code><br\/><br\/><kbd>anonymous_enable=NO (default Value) <br\/>local_enable=YES <br\/>write_enable=YES <br\/>local_umask=022 (default Value)<br\/>chroot_local_user=YES<\/kbd><br\/><br\/>Add the following lines at the end of the file, these settings\u00a0lock the server users to the FTP folder within the home directory :<br\/><br\/><kbd>user_sub_token=$USER <\/kbd><br\/><kbd>local_root=\/home\/$USER\/ftp<\/kbd><br\/><br\/>Save and Exit the configuration file. Press\u00a0<strong>CTRL + X<\/strong>\u00a0and confirm with<strong>\u00a0Y<\/strong>\u00a0to save the settings and exit.<br\/><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1628530600962\"><strong class=\"schema-how-to-step-name\">Create FTP user (optional)<\/strong> <p class=\"schema-how-to-step-text\">It is a good idea to create a different user to access your FTP server  which will not have <strong>sudo <\/strong>access to the server. Skip to step 6 if you want to use default user <strong>pi<\/strong>.<br\/><br\/><code>sudo adduser ftpuser<\/code><br\/><br\/>type a strong password and leave everything to default if you like.  Your terminal should look like the following image<img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"512\" src=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/new-user-and-group-rpi.png\" class=\"attachment-full size-full\" alt=\"Adding a new user in linux\" style=\"max-width: 100%; height: auto;\" srcset=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/new-user-and-group-rpi.png 979w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/new-user-and-group-rpi-300x157.png 300w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/new-user-and-group-rpi-768x402.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1628531307866\"><strong class=\"schema-how-to-step-name\">Create an FTP directory for the new user<\/strong> <p class=\"schema-how-to-step-text\">We will create an FTP directory and a subdirectory as we will remove write permission in the parent directory. <br\/><br\/><code>sudo mkdir -p \/home\/ftpuser\/ftp\/backups <\/code> <br\/>The\u00a0<strong><code>-p<\/code><\/strong>\u00a0argument instructs\u00a0<strong><code>mkdir<\/code><\/strong>\u00a0to create the entire path tree, both\u00a0<em>ftp<\/em>\u00a0and\u00a0<em>backups<\/em>\u00a0directories.<br\/><br\/>Since we used sudo to create a directory in the home folder of non-sudo user. The directory belongs to root user.<br\/><br\/>We can either add the user to sudoer group or change the directory permission. The latter is the better option. To change the ownership type &#8211; <br\/><br\/><code>sudo chown -R ftpuser:ftpuser \/home\/ftpuser\/ftp\/<\/code><br\/><img loading=\"lazy\" decoding=\"async\" width=\"759\" height=\"217\" src=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/directory-permission-issue-resolved.png\" class=\"attachment-full size-full\" alt=\"directory permission issue resolved\" style=\"max-width: 100%; height: auto;\" srcset=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/directory-permission-issue-resolved.png 759w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/directory-permission-issue-resolved-300x86.png 300w\" sizes=\"auto, (max-width: 759px) 100vw, 759px\" \/><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1628532633202\"><strong class=\"schema-how-to-step-name\">Change the permissions on the ftp directory:<\/strong> <p class=\"schema-how-to-step-text\">You must change the permission of the parent FTP directory, otherwise vsftpd will throw an error \u201c<em>vsftpd: refusing to run with writable root inside chroot()<\/em>\u201d<br\/><br\/><code>sudo chmod a-w \/home\/ftpuser\/ftp<\/code><br\/><br\/>sudo is not necessary if you are the default user <strong>p<\/strong>i.<br\/><br\/>P.S. Make sure you have made the directory for <strong>p<\/strong>i user  <code>mkdir -p \/home\/pi\/ftp\/backups   <\/code><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1628533174985\"><strong class=\"schema-how-to-step-name\">Restart Vsftpd Daemon<\/strong> <p class=\"schema-how-to-step-text\">To apply the changes we must restart the vsftpd daemon. Issue the following command &#8211; <br\/><code>sudo service vsftpd restart<\/code><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1628533288170\"><strong class=\"schema-how-to-step-name\">DONE!<\/strong> <p class=\"schema-how-to-step-text\">All right the FTP server is now working and ready to accept files via FTP. Grab the ip address of the server by issuing<code> ifconfig<\/code>, note it down we will need it in a bit. Given below is the process to connect to an FTP server.<\/p> <\/li><\/ol><\/div>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"how-to-connect-to-an-FTP-server\">Connect to an FTP Server<\/h4>\n\n\n\n<p>We need an FTP client to connect to our FTP server hosted on the raspberrypi4. Some of the most popular FTP clients are <a href=\"https:\/\/filezilla-project.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">FileZilla<\/a> and <a href=\"https:\/\/winscp.net\/eng\/download.php\" target=\"_blank\" rel=\"noreferrer noopener\">WinSCP<\/a>.  FileZilla supports almost all the operating systems. However, as I am on windows, we will use WinSCP to access the server.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Step 1: Download you favorite FTP Client. Mine is WinSCP<\/h6>\n\n\n\n<h6 class=\"wp-block-heading\">Step 2: Run the installation file and open WinSCP<\/h6>\n\n\n\n<h6 class=\"wp-block-heading\">Step 3: Select File Protocol &gt; FTP, Encryption &gt; No Encryption. Enter the IP address, username and password. Press LOGIN.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"547\" class=\"wp-image-24\" style=\"width: 850px;\" src=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-Logon-Screen.png\" alt=\"WinSCP Logon Screen\" srcset=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-Logon-Screen.png 1076w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-Logon-Screen-300x193.png 300w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-Logon-Screen-1024x660.png 1024w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-Logon-Screen-768x495.png 768w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/h6>\n\n\n\n<h6 class=\"wp-block-heading\">Step 4:  Upon login you will see the &#8220;backups&#8221; folder, that we gave full access to the user named &#8220;ftpuser&#8221;. Double click on the folder to access. You can only upload files inside it.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"547\" class=\"wp-image-26\" style=\"width: 850px;\" src=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-first-login.png\" alt=\"WinSCP first login\" srcset=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-first-login.png 1076w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-first-login-300x193.png 300w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-first-login-1024x660.png 1024w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/WinSCP-first-login-768x495.png 768w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/h6>\n\n\n\n<h6 class=\"wp-block-heading\">Step 5: To upload the required files, drag and drop the files from left window to the right or select the files and click on the upload button or keyboard shortcut &#8220;F5&#8221; and that is it. The file should successfully upload.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"547\" class=\"wp-image-25\" style=\"width: 850px;\" src=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/Successful-upload.png\" alt=\"Successful upload\" srcset=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/Successful-upload.png 1076w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/Successful-upload-300x193.png 300w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/Successful-upload-1024x660.png 1024w, https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/Successful-upload-768x495.png 768w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/h6>\n\n\n\n<p>If you like exploring and testing stuffs on your Raspberry Pi, click <a href=\"https:\/\/bytegeeks.net\/blog\/category\/linux\/raspberrypi\/\">here<\/a> for more.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a raspberrypi4 8GB variant, that is running as my network wide Ads blocker pi-hole, my home phone system 3cx and a few test websites on nginx. Yet this raspberrypi4 has a lot more to offer. So why not run an FTP server on a raspberrypi4 to backup all my public sites (of course [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":51,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[11,9],"class_list":["post-16","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberrypi","tag-ftp","tag-networking"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FTP server on a Raspberry Pi - ByteGeeks<\/title>\n<meta name=\"description\" content=\"Follow this step-by-step detailed guide to avoid missteps while you are trying to configure your Raspberry Pi to act as an FTP Server\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FTP server on a Raspberry Pi - ByteGeeks\" \/>\n<meta property=\"og:description\" content=\"Follow this step-by-step detailed guide to avoid missteps while you are trying to configure your Raspberry Pi to act as an FTP Server\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/\" \/>\n<meta property=\"og:site_name\" content=\"ByteGeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-15T13:26:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-16T11:40:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/FtpServerOnRPi4FeaturedPhoto.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Redwan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Redwan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/\",\"url\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/\",\"name\":\"FTP server on a Raspberry Pi - ByteGeeks\",\"isPartOf\":{\"@id\":\"https:\/\/bytegeeks.net\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/FtpServerOnRPi4FeaturedPhoto.png\",\"datePublished\":\"2021-08-15T13:26:50+00:00\",\"dateModified\":\"2021-08-16T11:40:32+00:00\",\"author\":{\"@id\":\"https:\/\/bytegeeks.net\/blog\/#\/schema\/person\/419ede240aa968b3bf8202cf9e94e792\"},\"description\":\"Follow this step-by-step detailed guide to avoid missteps while you are trying to configure your Raspberry Pi to act as an FTP Server\",\"breadcrumb\":{\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#primaryimage\",\"url\":\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/FtpServerOnRPi4FeaturedPhoto.png\",\"contentUrl\":\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/FtpServerOnRPi4FeaturedPhoto.png\",\"width\":1200,\"height\":630,\"caption\":\"FtpServerOnRPi4FeaturedPhoto\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/bytegeeks.net\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FTP server on a Raspberry Pi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/bytegeeks.net\/blog\/#website\",\"url\":\"https:\/\/bytegeeks.net\/blog\/\",\"name\":\"ByteGeeks\",\"description\":\"Your one-stop shop for everything IT\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/bytegeeks.net\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/bytegeeks.net\/blog\/#\/schema\/person\/419ede240aa968b3bf8202cf9e94e792\",\"name\":\"Redwan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bytegeeks.net\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/785ee4165b07a924d3e8538e8fd845bbd1d22e2680c18ebb16aa54890455e008?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/785ee4165b07a924d3e8538e8fd845bbd1d22e2680c18ebb16aa54890455e008?s=96&d=mm&r=g\",\"caption\":\"Redwan\"},\"description\":\"Just your average IT guy talking about IT stuff.\",\"sameAs\":[\"https:\/\/bytegeeks.net\/blog\"],\"url\":\"https:\/\/bytegeeks.net\/blog\/author\/redmin\/\"},{\"@type\":\"HowTo\",\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#howto-1\",\"name\":\"FTP server on a Raspberry Pi\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/\"},\"description\":\"<strong>Steps to follow<\/strong>\",\"totalTime\":\"P0DT0H10M\",\"step\":[{\"@type\":\"HowToStep\",\"url\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628524891396\",\"name\":\"Make sure your system is updated\",\"itemListElement\":[{\"@type\":\"HowToDirection\",\"text\":\"sudo apt update<br\/>sudo apt full-upgrade\"}]},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628525186581\",\"name\":\"Install the FTP server\",\"itemListElement\":[{\"@type\":\"HowToDirection\",\"text\":\"sudo apt install vsftpd\"}]},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628525434472\",\"name\":\"Edit the configuration file\",\"itemListElement\":[{\"@type\":\"HowToDirection\",\"text\":\"A few lines need to be edited to achieve our goal. Find the following lines in the configuration file. (Use Ctrl + W to quick search). Change the values of the following lines accordingly.<br\/><br\/><strong>Open<\/strong> the configuration file sudo nano \/etc\/vsftpd.conf<br\/><br\/>anonymous_enable=NO (default Value) <br\/>local_enable=YES <br\/>write_enable=YES <br\/>local_umask=022 (default Value)<br\/>chroot_local_user=YES<br\/><br\/>Add the following lines at the end of the file, these settings\u00a0lock the server users to the FTP folder within the home directory :<br\/><br\/>user_sub_token=$USER <br\/>local_root=\/home\/$USER\/ftp<br\/><br\/>Save and Exit the configuration file. Press\u00a0<strong>CTRL + X<\/strong>\u00a0and confirm with<strong>\u00a0Y<\/strong>\u00a0to save the settings and exit.<br\/>\"}]},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628530600962\",\"name\":\"Create FTP user (optional)\",\"itemListElement\":[{\"@type\":\"HowToDirection\",\"text\":\"It is a good idea to create a different user to access your FTP server  which will not have <strong>sudo <\/strong>access to the server. Skip to step 6 if you want to use default user <strong>pi<\/strong>.<br\/><br\/>sudo adduser ftpuser<br\/><br\/>type a strong password and leave everything to default if you like.  Your terminal should look like the following image\"}],\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#schema-image-b693a74823500980bf579499c31768bd\",\"url\":\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/new-user-and-group-rpi.png\",\"contentUrl\":\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/new-user-and-group-rpi.png\",\"width\":979,\"height\":512,\"caption\":\"Adding a new user in linux\"}},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628531307866\",\"name\":\"Create an FTP directory for the new user\",\"itemListElement\":[{\"@type\":\"HowToDirection\",\"text\":\"We will create an FTP directory and a subdirectory as we will remove write permission in the parent directory. <br\/><br\/>sudo mkdir -p \/home\/ftpuser\/ftp\/backups  <br\/>The\u00a0<strong>-p<\/strong>\u00a0argument instructs\u00a0<strong>mkdir<\/strong>\u00a0to create the entire path tree, both\u00a0<em>ftp<\/em>\u00a0and\u00a0<em>backups<\/em>\u00a0directories.<br\/><br\/>Since we used sudo to create a directory in the home folder of non-sudo user. The directory belongs to root user.<br\/><br\/>We can either add the user to sudoer group or change the directory permission. The latter is the better option. To change the ownership type - <br\/><br\/>sudo chown -R ftpuser:ftpuser \/home\/ftpuser\/ftp\/<br\/>\"}],\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#schema-image-6ce1edb483aeee18bb46580054344589\",\"url\":\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/directory-permission-issue-resolved.png\",\"contentUrl\":\"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/directory-permission-issue-resolved.png\",\"width\":759,\"height\":217,\"caption\":\"directory permission issue resolved\"}},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628532633202\",\"name\":\"Change the permissions on the ftp directory:\",\"itemListElement\":[{\"@type\":\"HowToDirection\",\"text\":\"You must change the permission of the parent FTP directory, otherwise vsftpd will throw an error \u201c<em>vsftpd: refusing to run with writable root inside chroot()<\/em>\u201d<br\/><br\/>sudo chmod a-w \/home\/ftpuser\/ftp<br\/><br\/>sudo is not necessary if you are the default user <strong>p<\/strong>i.<br\/><br\/>P.S. Make sure you have made the directory for <strong>p<\/strong>i user  mkdir -p \/home\/pi\/ftp\/backups   \"}]},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628533174985\",\"name\":\"Restart Vsftpd Daemon\",\"itemListElement\":[{\"@type\":\"HowToDirection\",\"text\":\"To apply the changes we must restart the vsftpd daemon. Issue the following command - <br\/>sudo service vsftpd restart\"}]},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628533288170\",\"name\":\"DONE!\",\"itemListElement\":[{\"@type\":\"HowToDirection\",\"text\":\"All right the FTP server is now working and ready to accept files via FTP. Grab the ip address of the server by issuing ifconfig, note it down we will need it in a bit. Given below is the process to connect to an FTP server.\"}]}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FTP server on a Raspberry Pi - ByteGeeks","description":"Follow this step-by-step detailed guide to avoid missteps while you are trying to configure your Raspberry Pi to act as an FTP Server","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/","og_locale":"en_US","og_type":"article","og_title":"FTP server on a Raspberry Pi - ByteGeeks","og_description":"Follow this step-by-step detailed guide to avoid missteps while you are trying to configure your Raspberry Pi to act as an FTP Server","og_url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/","og_site_name":"ByteGeeks","article_published_time":"2021-08-15T13:26:50+00:00","article_modified_time":"2021-08-16T11:40:32+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/FtpServerOnRPi4FeaturedPhoto.png","type":"image\/png"}],"author":"Redwan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Redwan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/","url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/","name":"FTP server on a Raspberry Pi - ByteGeeks","isPartOf":{"@id":"https:\/\/bytegeeks.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#primaryimage"},"image":{"@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#primaryimage"},"thumbnailUrl":"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/FtpServerOnRPi4FeaturedPhoto.png","datePublished":"2021-08-15T13:26:50+00:00","dateModified":"2021-08-16T11:40:32+00:00","author":{"@id":"https:\/\/bytegeeks.net\/blog\/#\/schema\/person\/419ede240aa968b3bf8202cf9e94e792"},"description":"Follow this step-by-step detailed guide to avoid missteps while you are trying to configure your Raspberry Pi to act as an FTP Server","breadcrumb":{"@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#primaryimage","url":"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/FtpServerOnRPi4FeaturedPhoto.png","contentUrl":"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/FtpServerOnRPi4FeaturedPhoto.png","width":1200,"height":630,"caption":"FtpServerOnRPi4FeaturedPhoto"},{"@type":"BreadcrumbList","@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bytegeeks.net\/blog\/"},{"@type":"ListItem","position":2,"name":"FTP server on a Raspberry Pi"}]},{"@type":"WebSite","@id":"https:\/\/bytegeeks.net\/blog\/#website","url":"https:\/\/bytegeeks.net\/blog\/","name":"ByteGeeks","description":"Your one-stop shop for everything IT","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/bytegeeks.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/bytegeeks.net\/blog\/#\/schema\/person\/419ede240aa968b3bf8202cf9e94e792","name":"Redwan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bytegeeks.net\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/785ee4165b07a924d3e8538e8fd845bbd1d22e2680c18ebb16aa54890455e008?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/785ee4165b07a924d3e8538e8fd845bbd1d22e2680c18ebb16aa54890455e008?s=96&d=mm&r=g","caption":"Redwan"},"description":"Just your average IT guy talking about IT stuff.","sameAs":["https:\/\/bytegeeks.net\/blog"],"url":"https:\/\/bytegeeks.net\/blog\/author\/redmin\/"},{"@type":"HowTo","@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#howto-1","name":"FTP server on a Raspberry Pi","mainEntityOfPage":{"@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/"},"description":"<strong>Steps to follow<\/strong>","totalTime":"P0DT0H10M","step":[{"@type":"HowToStep","url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628524891396","name":"Make sure your system is updated","itemListElement":[{"@type":"HowToDirection","text":"sudo apt update<br\/>sudo apt full-upgrade"}]},{"@type":"HowToStep","url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628525186581","name":"Install the FTP server","itemListElement":[{"@type":"HowToDirection","text":"sudo apt install vsftpd"}]},{"@type":"HowToStep","url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628525434472","name":"Edit the configuration file","itemListElement":[{"@type":"HowToDirection","text":"A few lines need to be edited to achieve our goal. Find the following lines in the configuration file. (Use Ctrl + W to quick search). Change the values of the following lines accordingly.<br\/><br\/><strong>Open<\/strong> the configuration file sudo nano \/etc\/vsftpd.conf<br\/><br\/>anonymous_enable=NO (default Value) <br\/>local_enable=YES <br\/>write_enable=YES <br\/>local_umask=022 (default Value)<br\/>chroot_local_user=YES<br\/><br\/>Add the following lines at the end of the file, these settings\u00a0lock the server users to the FTP folder within the home directory :<br\/><br\/>user_sub_token=$USER <br\/>local_root=\/home\/$USER\/ftp<br\/><br\/>Save and Exit the configuration file. Press\u00a0<strong>CTRL + X<\/strong>\u00a0and confirm with<strong>\u00a0Y<\/strong>\u00a0to save the settings and exit.<br\/>"}]},{"@type":"HowToStep","url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628530600962","name":"Create FTP user (optional)","itemListElement":[{"@type":"HowToDirection","text":"It is a good idea to create a different user to access your FTP server  which will not have <strong>sudo <\/strong>access to the server. Skip to step 6 if you want to use default user <strong>pi<\/strong>.<br\/><br\/>sudo adduser ftpuser<br\/><br\/>type a strong password and leave everything to default if you like.  Your terminal should look like the following image"}],"image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#schema-image-b693a74823500980bf579499c31768bd","url":"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/new-user-and-group-rpi.png","contentUrl":"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/new-user-and-group-rpi.png","width":979,"height":512,"caption":"Adding a new user in linux"}},{"@type":"HowToStep","url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628531307866","name":"Create an FTP directory for the new user","itemListElement":[{"@type":"HowToDirection","text":"We will create an FTP directory and a subdirectory as we will remove write permission in the parent directory. <br\/><br\/>sudo mkdir -p \/home\/ftpuser\/ftp\/backups  <br\/>The\u00a0<strong>-p<\/strong>\u00a0argument instructs\u00a0<strong>mkdir<\/strong>\u00a0to create the entire path tree, both\u00a0<em>ftp<\/em>\u00a0and\u00a0<em>backups<\/em>\u00a0directories.<br\/><br\/>Since we used sudo to create a directory in the home folder of non-sudo user. The directory belongs to root user.<br\/><br\/>We can either add the user to sudoer group or change the directory permission. The latter is the better option. To change the ownership type - <br\/><br\/>sudo chown -R ftpuser:ftpuser \/home\/ftpuser\/ftp\/<br\/>"}],"image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#schema-image-6ce1edb483aeee18bb46580054344589","url":"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/directory-permission-issue-resolved.png","contentUrl":"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/directory-permission-issue-resolved.png","width":759,"height":217,"caption":"directory permission issue resolved"}},{"@type":"HowToStep","url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628532633202","name":"Change the permissions on the ftp directory:","itemListElement":[{"@type":"HowToDirection","text":"You must change the permission of the parent FTP directory, otherwise vsftpd will throw an error \u201c<em>vsftpd: refusing to run with writable root inside chroot()<\/em>\u201d<br\/><br\/>sudo chmod a-w \/home\/ftpuser\/ftp<br\/><br\/>sudo is not necessary if you are the default user <strong>p<\/strong>i.<br\/><br\/>P.S. Make sure you have made the directory for <strong>p<\/strong>i user  mkdir -p \/home\/pi\/ftp\/backups   "}]},{"@type":"HowToStep","url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628533174985","name":"Restart Vsftpd Daemon","itemListElement":[{"@type":"HowToDirection","text":"To apply the changes we must restart the vsftpd daemon. Issue the following command - <br\/>sudo service vsftpd restart"}]},{"@type":"HowToStep","url":"https:\/\/bytegeeks.net\/blog\/ftp-server-on-a-raspberry-pi\/#how-to-step-1628533288170","name":"DONE!","itemListElement":[{"@type":"HowToDirection","text":"All right the FTP server is now working and ready to accept files via FTP. Grab the ip address of the server by issuing ifconfig, note it down we will need it in a bit. Given below is the process to connect to an FTP server."}]}],"inLanguage":"en-US"}]}},"jetpack_featured_media_url":"https:\/\/bytegeeks.net\/blog\/wp-content\/uploads\/2021\/08\/FtpServerOnRPi4FeaturedPhoto.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":10,"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":49,"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/posts\/16\/revisions\/49"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/media\/51"}],"wp:attachment":[{"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bytegeeks.net\/blog\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}