You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ubuntu 24.02 server
To automate claude updates it advises to run sudo chown -R $USER:$(id -gn) /usr && sudo chmod -R u+w /usr
This bricked the sudo system to no longer work and had to attach a rescue instance to fix the permissions of the files it broke.
I would like to hope this is user error but i dont know how else you would action this request.
Reacted by LiterallyAClown, Honglu Fan, Alessandro Candolini, arathunku and Jake
Reacted by diegogm, Tim Winter and mxd
Reacted by MaxKessler5, Alexander Carter, Pranav Soni, Magnus Groß, Honglu Fan, 馆长缠流子 and kdl
I tried suggesting to Anthropic that they needed to warn people about this several days ago: #43.
What the claude program advises is dangerous in terms of security and stability (as can be seen above). People should not be installing the program as root/superuser and the program should not be suggesting that they perform dangerous commands so that it can automatically update. As mentioned in the issue that I filed, Anthropic should update instructions to show people how to install Node packages as a non-privileged user. My experience is that claude works fine as a non-privileged user, installed by a non-privileged user.
Reacted by MaxKessler5, Yinette Hodge, Lucas Frendorf, Pranav Soni, niplav, Nicolas Martel, Peter Fry and Diego Tellez
This should theoretically work. However the last command gave me a number of errors with with fuse3, nodejs, and npm. The system now booted and I could uninstall the, purge, fix broken packages and reinstall cleanly.
*Also I should give credit to Gemini for helping me with this *
Sorry about this folks. We are now redirecting to our docs page that helps you set up a user accessible global npm prefix instead of changing permissions:
broke my sudo command completely. After running this, I received the error:
"sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set"
The command in your instructions should be modified to only affect directories needed by the CLI. Modifying permissions recursively across system directories is potentially dangerous and should come with clear warnings. Please consider revising the installation instructions to prevent other users from experiencing this issue.
How to fix it:
Boot from a live USB (I used EndeavourOS)
Mount your system partition (find it using lsblk):
sudo mount /dev/nvme0n1p2 /mnt # replace with your actual system partition
I strongly recommend modifying the install instructions to use a more targeted approach for whatever needs sudo-less write access. This recursive permission change is dangerous and should come with clear warnings.
I also fell victim to this today and completely destroyed my system. More concerningly, everyone who ran this command and did not break their system is now unknowingly running a severely compromised system where the entire /usr directory is writable by any program run by the user. Neat.
Here is what Claude has to say about this:
You're absolutely right to be concerned. That command is extremely problematic and should never have been recommended. It attempts to change ownership and permissions of the entire /usr directory to your user account, which would break many system components - as you've already seen with sudo.
This issue definitely needs to be reported to Anthropic. The Claude Code CLI should never recommend such a dangerous command that gives blanket write permissions to a critical system directory. That recommendation appears to be a serious error that could cause significant damage to users' systems.
OpenAI's ChatGPT says this:
Yeah, that command is absolutely unhinged. No installer should ever recommend recursively changing ownership and permissions for /usr. That’s a surefire way to break a system.
Claude Code recommending this command is wildly irresponsible. Definitely report this to Anthropic.
This is extremely bad stuff and needs to be taken seriously. The command has to be removed from the application ASAP.
Reacted by Peter Fry, TLA020, Eric McDonald, Olivia Schaefer, Annan Fay Yearian, ., Mika Cohen and animanoir
Sorry about this folks. We are now redirecting to our docs page that helps you set up a user accessible global npm prefix instead of changing permissions:
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
Activity
bcherny commentedon Feb 27, 2025
cc @sid374 mind taking a look?
MaxKessler5 commentedon Feb 27, 2025
What I had to do to fix this after mindlessly running the command:
In recovery mode, drop down into root:
sudo chown -R root:root /usrchmod u+s /usr/bin/sudoI'm assuming this is a prank, and to be fair, I needed the practice with xargs and awk and stuff, so hey, good one.
emcd commentedon Feb 27, 2025
I tried suggesting to Anthropic that they needed to warn people about this several days ago: #43.
What the
claudeprogram advises is dangerous in terms of security and stability (as can be seen above). People should not be installing the program as root/superuser and the program should not be suggesting that they perform dangerous commands so that it can automatically update. As mentioned in the issue that I filed, Anthropic should update instructions to show people how to install Node packages as a non-privileged user. My experience is thatclaudeworks fine as a non-privileged user, installed by a non-privileged user.ac2522 commentedon Feb 27, 2025
I was also silly enough to run this.. On Ubuntu 22.04,
My fix:
This should theoretically work. However the last command gave me a number of errors with with fuse3, nodejs, and npm. The system now booted and I could uninstall the, purge, fix broken packages and reinstall cleanly.
*Also I should give credit to Gemini for helping me with this *
ps428 commentedon Feb 27, 2025
Hey @BumbleTree & @ac2522 ,
I ran into the same issue on my Arch. Here's how I fixed it:
lsblk/mnt:sudo mount /dev/sdXY /mnt(Replace sdXY with your system partition)arch-chrootinto the mounted disk:sudo arch-chroot /mntchown -R root:root /usrsudo chmod -R 755 /usrI had several iterations before I was able to fix it, if these don't work, then just chroot again and run these commands as well:
For Ubuntu, I think the process should be similar, but use
sudo chroot /mntinstead of arch-chroot.Hope this helps!
sid374 commentedon Feb 28, 2025
Sorry about this folks. We are now redirecting to our docs page that helps you set up a user accessible global npm prefix instead of changing permissions:
https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview#auto-updater-permission-options
TLA020 commentedon Feb 28, 2025
The suggested command breaks your whole system
sudo chown -R $USER:$(id -gn) /usr/local && sudo chmod -R u+w /usr/localbroke my sudo command completely. After running this, I received the error:
"sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set"
The command in your instructions should be modified to only affect directories needed by the CLI. Modifying permissions recursively across system directories is potentially dangerous and should come with clear warnings. Please consider revising the installation instructions to prevent other users from experiencing this issue.
How to fix it:
lsblk):sudo mount /dev/nvme0n1p2 /mnt # replace with your actual system partitionsudo mount /dev/nvme0n1p1 /mnt/boot # if neededchown -R root:root /usr chmod -R 755 /usr # Set setuid bit for critical binaries chmod u+s /usr/bin/sudo chmod u+s /usr/bin/su chmod u+s /usr/bin/passwd chmod u+s /usr/bin/newgrp chmod u+s /usr/bin/gpasswd chmod u+s /usr/bin/chsh chmod u+s /usr/bin/chfnexit sudo umount -R /mnt rebootI strongly recommend modifying the install instructions to use a more targeted approach for whatever needs sudo-less write access. This recursive permission change is dangerous and should come with clear warnings.
Maybe nice discount?
oxysoft commentedon Mar 2, 2025
I also fell victim to this today and completely destroyed my system. More concerningly, everyone who ran this command and did not break their system is now unknowingly running a severely compromised system where the entire
/usrdirectory is writable by any program run by the user. Neat.Here is what Claude has to say about this:
OpenAI's ChatGPT says this:
This is extremely bad stuff and needs to be taken seriously. The command has to be removed from the application ASAP.
petenorth commentedon Mar 2, 2025
not really good enough, need to do a lot better.
sid374 commentedon Mar 6, 2025
Updating this thread with a troubleshooting guide available here for folks who have run into this issue.
micos7 commentedon Apr 8, 2025
Best part of this,beside me being a lemming pasting commands in the terminal ,is having a fresh install of the latest Ubuntu.
github-actions commentedon Aug 11, 2025
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.