You are not logged in.
Hello everyone.
I got this error when i use sudo.I installed nodejs after i did a
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
to allow for npm install -g without needing sudo.
Then i got " sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set " error
ls -l /usr/bin/sudo
print this
-rwsr-xr-x 1 arc root 132408 Oca 21 19:06 /usr/bin/sudo
Offline
How did the owner of sudo become arc?
Use su to start a root shell (you will need the root password). As root, change the ownership of sudo back to root. Exit the root shell with ctrl-d.
Don't do this again
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Welcome to the forums berat703
What on earth led you to believe that the first command you ran was a good idea?
You might be able to recover by logging in as root and running...
chown -R root /usr/{lib/node_modules,bin,share}
Offline
This happened because the nodejs programming language is a toxic environment that habitually suggests you mutilate your operating system for the sake of npm's convenience...
Fun fact: recently npm had a bug where they ran that chown command for you automatically if you used npm via sudo: https://github.com/npm/npm/issues/19883
They fixed it quite fast and issued an emergency patch release. Unfortunately no one can create a patch release for the many morons on the internet who suggest doing this manually and by offering this bad advice cause many people to inadvertently break their systems.
Oh well, now you know not to do that again. Have fun reinstalling your Arch Linux installation.
Slithery: simply chowning everything to root is not a solution, as there are files which are owned by different users. I wouldn't want to guarantee that this will catch everything even though it didn't also mutilate /var
OTOH with some care one might be able to use paccheck (from pacutils) to triple-check the ownership of all files on the system. At least the OP's command did not modify the group as well as the owner as many files e.g. commands in /usr/bin use setgid to run as some special per-software system user...
Last edited by eschwartz (2018-03-25 15:17:38)
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Welcome to the forums berat703
What on earth led you to believe that the first command you ran was a good idea?
You might be able to recover by logging in as root and running...chown -R root /usr/{lib/node_modules,bin,share}
i'm glad to be here .Thank you .
I tried this code then print is
-rwxr-xr-x 1 root root 132408 Oca 21 19:06 /usr/bin/sudo
But if arc user write "sudo su" , the error display again.
Last edited by berat703 (2018-03-25 17:05:02)
Offline
This happened because the nodejs programming language is a toxic environment that habitually suggests you mutilate your operating system for the sake of npm's convenience...
Fun fact: recently npm had a bug where they ran that chown command for you automatically if you used npm via sudo: https://github.com/npm/npm/issues/19883
They fixed it quite fast and issued an emergency patch release. Unfortunately no one can create a patch release for the many morons on the internet who suggest doing this manually and by offering this bad advice cause many people to inadvertently break their systems.
Oh well, now you know not to do that again. Have fun reinstalling your Arch Linux installation.
Slithery: simply chowning everything to root is not a solution, as there are files which are owned by different users. I wouldn't want to guarantee that this will catch everything even though it didn't also mutilate /var
OTOH with some care one might be able to use paccheck (from pacutils) to triple-check the ownership of all files on the system. At least the OP's command did not modify the group as well as the owner as many files e.g. commands in /usr/bin use setgid to run as some special per-software system user...
You are definitely right for all your said.Especially about in npm.So i don't wanna reinstall OS.Have i another way this problem's solution?
Offline
Eschwartz wrote:Oh well, now you know not to do that again. Have fun reinstalling your Arch Linux installation.
OTOH with some care one might be able to use paccheck (from pacutils) to triple-check the ownership of all files on the system. At least the OP's command did not modify the group as well as the owner as many files e.g. commands in /usr/bin use setgid to run as some special per-software system user...
You are definitely right for all your said.Especially about in npm.So i don't wanna reinstall OS.Have i another way this problem's solution?
Emphasis added
Offline
But if arc user write "sudo su" , the error display again.
... and have the setuid bit set ..
chmod u+s /usr/bin/sudo
Still run paccheck - and purge npm....
Online
berat703 wrote:But if arc user write "sudo su" , the error display again.
... and have the setuid bit set ..
chmod u+s /usr/bin/sudo
Still run paccheck - and purge npm....
It's worked! Thanks!
Offline