What are the risks of running 'sudo pip'?

前端 未结 4 2105
猫巷女王i
猫巷女王i 2020-11-22 07:52

Occasionally I run into comments or responses that state emphatically that running pip under sudo is \"wrong\" or \"bad\", but there are cases (inc

4条回答
  •  情深已故
    2020-11-22 08:19

    When you run pip with sudo, you run setup.py with sudo. In other words, you run arbitrary Python code from the Internet as root. If someone puts up a malicious project on PyPI and you install it, you give an attacker root access to your machine. Prior to some recent fixes to pip and PyPI, an attacker could also run a man in the middle attack to inject their code when you download a trustworthy project.

提交回复
热议问题