How can I use drush as root user on a VPS to install drupal as a domain user?

StackOverflow https://stackoverflow.com/questions/16426484

  •  14-04-2022
  •  | 
  •  

Domanda

If I am logged in as root and cd to a domain user folder such as /home/mysite/www and I then use drush as follows

drush site-install standard --account-name=mysite --account-pass= "*****"
--db-url=mysql://my_site_admin:"*****"@localhost/my_site

It installs everything as root:root for uid:gid and the site produces error

SoftException in Application.cpp:357: UID of script "/home/sites/mx3/public_html
/index.php" is smaller than min_uid,

How can I install using mysite:mysite for permissions while logged in as root?

È stato utile?

Soluzione

You do not want to run a script as root, if it is not necessary. Never.

Instead you should run it as the user of this site.

Version 1:

$ sudo -i -u websiteuser
$ drush site-install ...

Version 2:

$ sudo -u websiteuser drush site-install ...

For version 1 the websiteuser needs to habe a valid login shell, because you login as this user and work in his shell session. You stay in websiteuser's login shell, until you explicitly logout.

For version 2 the drush command is run instead of the login shell. After the drush command, you are back in root shell.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top