D
D
driverx182019-06-03 15:31:27
Composer
driverx18, 2019-06-03 15:31:27

Why can't you run composer install as root?

Logged in as root under VPS, did composer require / install, and composer says don't do this under root.
Why is that? What is the harm from this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2019-06-03
@HeadOnFire

We turn on simple logic - under root, any script is executed with full access to the body, including the ability to perform destructive operations without asking permission from a naive user. So? So.
Next - we put third-party code as Composer, who the hell knows what's in that code (you don't personally check all packages, and then recursively their dependencies, and the dependencies of their dependencies). Therefore, to do so is ay-yay-yay-danger. Risky. What Composer is hinting at.
Also, doing anything as root on a server is bad practice. Exactly for the same reasons - so as not to copy-paste some code from these Internets of yours into the command line in the old fashioned way - and then, as in the FanatPHP comment about the classics .
There must be a separate user that you are connecting with, and he has sudo rights. Use these rights only in extreme cases, when they are really needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question