- Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to [switch to the Magento file system owner]({{ page.baseurl }}/install-gde/prereq/file-sys-perms-over.html).
If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:
su <Magento file system owner> -s /bin/bash -c <command>If the Magento file system owner does not allow logins you can do the following:
sudo -u <Magento file system owner> <command>- To run Magento commands from any directory, add
<magento_root>/binto your systemPATH.
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
bash shell example for CentOS:
export PATH=$PATH:/var/www/html/magento2/bin{:.bs-callout .bs-callout-info} You can also run the commands in the following ways:
cd <magento_root>/binand run them as./magento <command name><magento_root>/bin/magento <command name><magento_root>is a subdirectory of your web server's docroot. [Need help locating the docroot?]({{ page.baseurl }}/install-gde/basics/basics_docroot.html)