I want to execute composer as non root user. So I renamed main composer executable file to composer-call
and then create another executable file called composer
.
#composer.sh
su nginx -c "composer-call ${@}"
Now when I execute composer --version
it works but while pass some more complex parameters like composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
it shows below error
+ su nginx -c 'composer-call create-project' drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
su: unrecognized option: stability
Update-1
As per below answer by Jeff I tried his answer but it gives me another error. Expecting a better solution.
composer-call: line 2: can't open ?php: no such file
composer-call: line 3: /bin: Permission denied
+ su nginx -- composer-call composer-call docker-php-entrypoint docker-php-ext-configure docker-php-ext-enable docker-php-ext-install docker-php-source drupal drush pear peardev pecl phar phar.phar php php-config phpdbg phpize This file is part of Composer.
su: must be suid to work properly
+ su nginx -- composer-call composer-call docker-php-entrypoint docker-php-ext-configure docker-php-ext-enable docker-php-ext-install docker-php-source drupal drush pear peardev pecl phar phar.phar php php-config phpdbg phpize
su: must be suid to work properly
composer-call: line 6: syntax error: unexpected word (expecting ")")
NOTE: composer-call is a php cli script.
su: must be suid to work properly
-- it appears yoursu
is not setuid. Can you repair that? – Jeff Schaller Oct 18 '18 at 12:47composer-call
script; perhaps you could share that portion of the script? – Jeff Schaller Oct 18 '18 at 12:47