
{"id":53,"date":"2025-06-23T13:11:43","date_gmt":"2025-06-23T11:11:43","guid":{"rendered":"https:\/\/stayno.com\/?p=53"},"modified":"2025-06-23T13:11:43","modified_gmt":"2025-06-23T11:11:43","slug":"example-permission-commands-for-web-resource-on-apache2","status":"publish","type":"post","link":"https:\/\/stayno.com\/index.php\/2025\/06\/23\/example-permission-commands-for-web-resource-on-apache2\/","title":{"rendered":"Example permission commands for web resource on apache2"},"content":{"rendered":"\n<p>Okay so these are some example commands that I find useful when I am on my development environment. These are ran on Ubuntu 24, I guess they work for all flavors of Linux just mind the directory structure. Make a folder that you would like to hold your files for example a folder named simple_csv_expenses_parser\/ inside the \/var\/www\/ folder. <\/p>\n\n\n\n<p>Now to make it easier to develop without using a superuser every time we need to set permissions. There are 3 major tasks we need to complete:<\/p>\n\n\n\n<p>NB!!! If you have .git folder inside your web resource think about giving it apache2 permission access first. Another way is to create a public folder and point the Document Root to that.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1. Give apache2 group, www-data, access to the folders and files<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chgrp -R www-data \/var\/www\/simple_csv_expenses_parser\/\n\nsudo find \/var\/www\/simple_csv_expenses_parser\/ -type d -exec chmod g+rx {} +\n\nsudo find \/var\/www\/simple_csv_expenses_parser\/ -type f -exec chmod g+r {} +<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>2. Give the user that is going to develop his permissions<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown -R vagrant \/var\/www\/simple_csv_expenses_parser\/\n\nsudo find \/var\/www\/simple_csv_expenses_parser\/ -type d -exec chmod u+rwx {} +\n\nsudo find \/var\/www\/simple_csv_expenses_parser\/ -type f -exec chmod u+rw {} +\n\n<\/code><\/pre>\n\n\n\n<p>NB!!! Change vagrant to whatever username you have<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>3. Set folder so every new file created has the apache2 www-data group permissions<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo find \/var\/www\/simple_csv_expenses_parser\/ -type d -exec chmod g+s {} +<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Okay so these are some example commands that I find useful when I am on my development environment. These are ran on Ubuntu 24, I guess they work for all flavors of Linux just mind the directory structure. Make a folder that you would like to hold your files for example a folder named simple_csv_expenses_parser\/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,20],"tags":[25,22,26,9],"class_list":["post-53","post","type-post","status-publish","format-standard","hentry","category-staynonotes","category-superuser","tag-apache2","tag-command","tag-permission","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/posts\/53","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/comments?post=53"}],"version-history":[{"count":1,"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/posts\/53\/revisions"}],"predecessor-version":[{"id":54,"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/posts\/53\/revisions\/54"}],"wp:attachment":[{"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/media?parent=53"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/categories?post=53"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stayno.com\/index.php\/wp-json\/wp\/v2\/tags?post=53"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}