1

I'm developer, not system administrator, and I'm trying out to configure Magento environment production like.

I'm stuck in 'Set ownership and permissions for two users' 'Step 5: Set ownership and permissions for the shared group'

https://devdocs.magento.com/guides/v2.3/install-gde/prereq/file-system-perms.html

So I have Ubuntu on my laptop, apache2, php, mysql.

created Magento install dir from 'sudo' in /var/www/html/magento2

next steps would be

switch to, the Magento file system owner.
Enter the following commands in the order shown:

cd /var/www/html/magento2/
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
sudo chown -R :www-data .
chmod u+x bin/magento

find: ‘var’: No such file or directory
find: ‘generated’: No such file or directory
find: ‘vendor’: No such file or directory
find: ‘pub/static’: No such file or directory
find: ‘pub/media’: No such file or directory
find: ‘app/etc’: No such file or directory

at this point I add some forward slash

find /var /generated /vendor /pub/static /pub/media /app/etc -type f -exec chmod g+w {} \;

...
chmod: changing permissions of '/var/log/dpkg.log.2.gz': Operation not permitted
chmod: changing permissions of '/var/log/alternatives.log.6.gz': Operation not permitted
find: ‘/generated’: No such file or directory
find: ‘/vendor’: No such file or directory
find: ‘/pub/static’: No such file or directory
find: ‘/pub/media’: No such file or directory
find: ‘/app/etc’: No such file or directory

So: on Ubuntu my 'web server group' would be 'www-data'

groups magento_user
magento_user : magento_user www-data

ps aux | grep apache
root      1010  0.0  0.3 499316 30644 ?        Ss   14:18   0:00 /usr/sbin/apache2 -k start
www-data  1066  0.0  0.2 501648 17684 ?        S    14:18   0:00 /usr/sbin/apache2 -k start
www-data  1067  0.0  0.2 501648 17684 ?        S    14:18   0:00 /usr/sbin/apache2 -k start
www-data  1068  0.0  0.2 501648 17684 ?        S    14:18   0:00 /usr/sbin/apache2 -k start
www-data  1069  0.0  0.2 501648 17684 ?        S    14:18   0:00 /usr/sbin/apache2 -k start
www-data  1070  0.0  0.2 501648 17684 ?        S    14:18   0:00 /usr/sbin/apache2 -k start
magento+ 16295  0.0  0.0  14432  1088 pts/0    S+   14:49   0:00 grep --color=auto apache

groups www-data 
www-data : www-data

so despite 'www-data' group I still don't have permission.

In the event file system permissions are set improperly and can’t be changed by the Magento file system owner, 
you can enter the command as a user with root privileges:

so I did, changed to root

cd /var/www/html/magento2/
sudo find /var /generated /vendor /pub/static /pub/media /app/etc -type f -exec chmod g+w {} \; && find /var /generated /vendor /pub/static /pub/media /app/etc -type d -exec chmod g+ws {} \; && chown -R :www-data . && chmod u+x bin/magento

no complaints about permission, only missing dir structure

$ cd ../
/var/www/html$ ls -l
total 20
-rw-rw-r-- 1 root root 10918 ott  1 15:17 index.html
drwxr-xr-x 2 root root  4096 ott  2 12:30 magento2
-rw-rw-r-- 1 root root    68 ott  1 17:16 phpinfo.php

And if I try next step

Install Magento using Composer

https://devdocs.magento.com/guides/v2.3/install-gde/composer.html

magento_user@roman-pc:/var/www/html$ composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento2
Installing magento/project-community-edition (2.2.6)
  - Installing magento/project-community-edition (2.2.6): Downloading (connectinDownloading (100%)         
Downloading (100%)         
Downloading (100%)         
In Filesystem.php line 232:

  Could not delete magento2/:  


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

My questions are:

  • why my folder structure is different
  • why magento_user still without permission

If I'm following wrong direction please try to be explicit on how to proceed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.