2

I downloaded Bitnami's Magento VM (OVA, using it in vmware on windows). It is a Debian 9 (Debian GNU/Linux 9.8 (stretch)) with Apache/2.4.39 (Unix), PHP 7.1.27. By default, it is configured to serve Magento from /opt/bitnami/apps/magento/htdocs enter image description here The user I can use to connect with SSH is the bitnami user, which does not have permission to modify files in magento's directory. All the services are configured to run with another user, like daemon or mysql. enter image description here

What am I supposed to do to be able to open magento's directory through SFTP with an IDE on my host system and be able to deploy files too? enter image description here

My understanding was I can connect with SSH, leave the terminal open, so I can run commands using bin/magento or use git in the directory and have PhpStorm on my host system edit and deploy files, while I can use the bitnami vm's ip to open the website in my browser.

Edit.: I jsut realized, there is a magento installation in ~/apps/magento/htdocs too, why?

13
  • Please read through devdocs.magento.com/guides/v2.3/config-guide/prod/… this will answer any questions you may have regarding file permissions Apr 12, 2019 at 9:27
  • @DavaGordon Do I need to reconfigure the whole bitnami vm then? Change the php-fpm, apache users to a group and change the ownership of the files to the group somehow? I mean, this is supposed to work, I think I am missing something
    – szabkel
    Apr 12, 2019 at 14:09
  • No id suggest just changing the permissions of the magneto directory can i suggest you take a look at magento.stackexchange.com/questions/91870/… i dont see the point in duplicating content which is already provided. any issues just message back. Apr 12, 2019 at 14:49
  • also after a quick search i can see that similar issues on AWS have been raised. please see support.weltpixel.com/hc/en-us/articles/… for reference Apr 12, 2019 at 14:51
  • @DavaGordon I am not sure. I fired up a new bitnami vm, changed the permissions according to the post you mention and it broke the installation.
    – szabkel
    Apr 15, 2019 at 8:28

1 Answer 1

2

I kind of solved this, but remember not to use this solution when you are on a production machine!

By default, the bitnami VM is configured with the correct permissions and with a one-user approach. The user which owns the directory is daemon, also used for apache. It is not possible to easily add permissions for the bitnami user.

The daemon user is a service user, but we can change it to allow us to login with SSH/SFTP on our PhpStorm.

  1. Login as the bitnami user
  2. Change the daemon user's type with sudo usermod -s /bin/bash daemon (you can view the result before and after with cat /etc/passwd)
  3. Create a password for the daemon user: sudo passwd daemon
  4. Configure PhpStorm to use the remote server with the daemon user (over SFTP)

All the new files uploaded will be using the correct permissions and you can change existing files too, like the ./.gitignore file.

Another important thing is, for every other task, you should still use the bitnami user (it helps to remember that the daemon user is not in the sudoers file, so you won't be able to sudo with it). Bitnami already has a wrapper for the bin/magento untility, you should always use the bitnami user and sudo ./bin/magento-cli to run cli commands, like cache:clean..etc, like you would do without this change.

You can easily revert this change, if you run sudo usermod -s /usr/sbin/nologin daemon

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.