{"id":292,"date":"2016-03-26T20:51:11","date_gmt":"2016-03-26T20:51:11","guid":{"rendered":"https:\/\/notiz.comanet.xyz\/?p=292"},"modified":"2019-03-03T19:42:29","modified_gmt":"2019-03-03T18:42:29","slug":"ftp-permissions","status":"publish","type":"post","link":"https:\/\/notiz.comanet.xyz\/?p=292","title":{"rendered":"FTP Permissions"},"content":{"rendered":"<ol>\n<li> \t\tAdd <code><font face=\"Courier New\">pi<\/font><\/code> to the <code><font face=\"Courier New\">www-data<\/font><\/code> group using the command <code><font face=\"Courier New\">sudo adduser pi www-data<\/font><\/code><\/li>\n<li> \t\tAdd <code><font face=\"Courier New\">www-data<\/font><\/code> to the <code><font face=\"Courier New\">pi<\/font><\/code> group using the command <code><font face=\"Courier New\">sudo adduser www-data pi<\/font><\/code><\/li>\n<li> \t\tChange the permission of the directory and everything in it so that it&#39;s readable and writable by the group. Use the command <code><font face=\"Courier New\">sudo chmod -R 775 \/var\/www<\/font><\/code>.<\/li>\n<li> \t\tSince user <code><font face=\"Courier New\">pi<\/font><\/code> is part of <code><font face=\"Courier New\">www-data<\/font><\/code> group, doing this allows the pi to modify files.<\/li>\n<li> \t\tSince user <code><font face=\"Courier New\">www-data<\/font><\/code> is part of <code><font face=\"Courier New\">pi<\/font><\/code> group, this allows nginx to read files created by <code><font face=\"Courier New\">pi<\/font><\/code>.<\/li>\n<li> \t\tConfusing? This is because users <code><font face=\"Courier New\">www-data<\/font><\/code> and <code><font face=\"Courier New\">pi<\/font><\/code> have their own groups also named <code><font face=\"Courier New\">www-data<\/font><\/code> and <code><font face=\"Courier New\">pi<\/font><\/code>.<\/li>\n<li>\n<div> \t\t\tMake sure everything in the folder is owned by <code><font face=\"Courier New\">www-data<\/font><\/code>.<\/div>\n<ul>\n<li> \t\t\t\t<code><font face=\"Courier New\">sudo chgrp -R www-data \/var\/www<\/font><\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<div> \tOder: \t<\/p>\n<ol>\n<li> \t\t\t<span>sudo chmod g+s \/var\/www<\/span><\/li>\n<li class=\"even\"> \t\t\t<span>sudo chmod <\/span><span class=\"nu0\">775<\/span><span> \/var\/www<\/span><\/li>\n<li class=\"odd\"> \t\t\t<span>sudo chown -R www-data:www-data \/var\/www<\/span><\/li>\n<\/ol>\n<h2> \t\t<span style=\"color: rgb(255, 153, 0);\">useradd Example<\/span> &ndash; Add <em>a new user<\/em> to secondary group<\/h2>\n<p> \t\tYou need to the useradd command to add new users to existing group (or create a new group and then add user). If group does not exist, create it. The syntax is as follows:<br \/> \t\t<code><font face=\"Courier New\">useradd -G {<\/font><span style=\"color: rgb(153, 102, 51);\"><font face=\"Courier New\">group-name<\/font><\/span><font face=\"Courier New\">} <\/font><span style=\"color: rgb(102, 51, 51);\"><font face=\"Courier New\">username<\/font><\/span><\/code><\/p>\n<h2> \t\t<span style=\"color: rgb(255, 153, 0);\">usermod example<\/span> &ndash; Add<em> a existing user<\/em> to existing group<\/h2>\n<p> \t\tAdd existing user tony to ftp supplementary\/secondary group with the usermod command using the <kbd>-a<\/kbd> option ~ i.e. add the user to the supplemental group(s). Use only with <kbd>-G<\/kbd> option:<br \/> \t\t<code><font face=\"Courier New\"># usermod -a -G ftp tony<\/font><\/code><\/p>\n<p class=\"odd\"> \t\t&nbsp;<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Add pi to the www-data group using the command sudo adduser pi www-data Add www-data to the pi group using the command sudo adduser www-data pi Change the permission of the directory and everything in it so that it&#39;s readable and writable by the group. Use the command sudo chmod -R 775 \/var\/www. Since user&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-292","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts\/292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=292"}],"version-history":[{"count":1,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts\/292\/revisions"}],"predecessor-version":[{"id":375,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts\/292\/revisions\/375"}],"wp:attachment":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}