-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] npm i -g foo
changes ownership of files under /usr/bin
#4010
Comments
hi, what is the timeline for this? it's critical for stations with end point protection, for example my Macbook with SentinelOne. I can't upgrade my global npm because of this. |
Same issue as #3705 |
@nlf Could you look at this or pass the information ? It seem a pretty serious issue |
Node: v14.19.0 I just lost sudo privileges on my server after running
This is bad! |
@emi2k01 Does this makes sense? #3705 (comment) What is the ownership of you |
I have no idea, sorry. This was a long time ago and I switched to installing binaries under |
There is an rrfc open for this npm/rfcs#546 |
I just encountered a variant of this issue that made me think my entire machine was compromised.
I'm running an old version of |
@michaelsproul you should never, ever run npm with sudo unless it’s with |
I'm deleting every trace of it right now. |
npm@9 no longer attempts to modify file ownership at all, which should resolve this problem. please feel free to reopen this issue if you still experience this after updating to the latest npm@9. |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
After running
sudo npm i -g foo
files under/usr/bin
that were owned byroot
are now owned by the current user.I ran
sudo npm i -g typescript
and it was installed correctly I think. Then I ransudo npm i -g vscode-langservers-extracted
and I gotsudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
.I think the packages I installed are irrelevant because I still get the same errors after installing other packages globally with sudo.
This looks similar to #19883 but as far as I can see, only
/usr/bin/
files are affected.Expected Behavior
npm should not change ownership of files under
/usr/bin
Steps To Reproduce
Linux
npm v8.1.3
Default
In this video, you can see what happens. When I stop writing is because I'm going to another tty as root to execute
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
. The video also shows npm with versionv8.0.0
but I updated tov8.1.3
and the same thing happens.2021-11-07.14-39-43.mov
Environment
The text was updated successfully, but these errors were encountered: