Log in to the Magento server as, or switch to, a user with permissions to write to the Magento file system. See switch to the file system owner.
If you use the bash shell, you can use the following syntax to switch to the file system owner and enter the command at the same time:
su <file system owner> -s /bin/bash -c <command>
If the file system owner does not allow logins, you can do the following:
sudo -u <file system owner> <command>
To run Magento commands from any directory, add
<magento_root>/binto your system
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
Sample bash shell for CentOS:
Optionally, you can 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 docroot.
In addition to the command arguments discussed here, see Common arguments.
Before you run this command, you must Create or update the deployment configuration.
Display the Admin URI
1 bin/magento info:adminuri
A sample result follows:
1 Admin Panel URI: /admin_1wgrah
You can also view the Admin URI in
<magento_root>/app/etc/env.php. A snippet follows:
1 2 3 4 'backend' => array ( 'frontName' => 'admin_1wgrah', ),
Change the Admin URL
To change the Admin URI, use the magento setup:config:set command.