From Scorching Partdridge, 1 Year ago, written in Bash.
  1. # I use nvm to manage node.js versions on a per-user basis, but noticed my system node was outdated and wanted to update
  2.  
  3. dsk@red:~$ sudo node -v
  4. v4.4.7
  5. dsk@red:~$ sudo nvm
  6. sudo: nvm: command not found
  7.  
  8. # At this point I googled how and found a command from digitalocean: http://stackoverflow.com/a/29903645
  9.  
  10. dsk@red:~$ n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
  11. chmod: changing permissions of ‘/usr/bin/[’: Operation not permitted
  12. chmod: changing permissions of ‘/usr/bin/2to3’: Operation not permitted
  13. chmod: changing permissions of ‘/usr/bin/2to3-2.7’: Operation not permitted
  14. # (lots of these...)
  15. chmod: changing permissions of ‘/usr/bin/zipdetails’: Operation not permitted
  16. chmod: changing permissions of ‘/usr/bin/zsoelim’: Operation not permitted
  17. dsk@red:~$ sudo node -v
  18. v4.4.7
  19. dsk@red:~$ nvm use 6
  20. Now using node v6.2.2 (npm v3.9.5)
  21. dsk@red:~$ n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
  22. sudo: /usr/local/bin/sudo must be owned by uid 0 and have the setuid bit set
  23. dsk@red:~$ sudo node -v
  24. sudo: /usr/local/bin/sudo must be owned by uid 0 and have the setuid bit set
  25. dsk@red:~$ sudo which node
  26. sudo: /usr/local/bin/sudo must be owned by uid 0 and have the setuid bit set
  27. dsk@red:~$ node -v
  28. v6.2.2
  29. dsk@red:~$ sudo
  30. sudo: /usr/local/bin/sudo must be owned by uid 0 and have the setuid bit set
  31.  
  32.  
  33. ## #linux on freenode:
  34. # 19:01 DSKrepps        I broke sudo... any help? https://paste.linux.community/view/c03fee66 Ubuntu 14.04.4 LTS
  35. # 19:01 johnkeates      DSKrepps: you must login as root
  36. # 19:01 johnkeates      if you can't you will have to use recovery methods
  37. # 19:02 johnkeates      DSKrepps: try: su
  38. # 19:02 johnkeates      if that doesn't work, recovery is your only option
  39. # 19:02 ohcanada        chmod -R is stupidity of the first water, the ultimate linux crime. only perpetrated by lusers
  40. # 19:03 DSKrepps        johnkeates: su says authentication failure when I'm entering the correct password. How did this even happen?
  41. # 19:04 hassoon johnkeates: how about sudo
  42. # 19:04 hassoon DSKrepps: *
  43. # 19:04 johnkeates      he broke his sudo
  44. # 19:04 hassoon lmao
  45. # 19:04 DSKrepps        sudo: /usr/local/bin/sudo must be owned by uid 0 and have the setuid bit set
  46. # 19:04 johnkeates      setuid and owner on sudo got shitted
  47. # 19:05 ananke  DSKrepps: there's your culprit: chmod -R 755 $n/bin/*
  48. # 19:05 johnkeates      it might be easiest to simply reinstall
  49. # 19:05 johnkeates      or distro-uprgade
  50. # 19:05 DSKrepps        I see, but is digitalocean really telling people to use a command that breaks stuff?
  51. # 19:05 johnkeates      yes
  52. # 19:05 johnkeates      well
  53. # 19:05 johnkeates      not really
  54. # 19:05 ananke  DSKrepps: rpm world has a nice way to fix perms for files that were installed by packages. not sure about ubuntu
  55. # 19:05 johnkeates      ubuntu has one
  56. # 19:05 johnkeates      but only if you're root
  57. # 19:05 johnkeates      ha.
  58. # 19:05 johnkeates      bet rpm has the same problem
  59. # 19:05 DSKrepps        Reinstalling won't be hard.
  60. # 19:06 ohcanada        the whole thing is culpable. not checking that $n is not null. chmod -R. the whole thing is a disaster
  61. # 19:06 johnkeates      it's as bad as systemd
  62. # 19:06         johnkeates  likes extending any mishap to include systemd
  63. # 19:07 ohcanada        nobody, but nobody in their right mind would *ever* even contemplate issuing a chmod -R command
  64. # 19:07 johnkeates      i do
  65. # 19:07 johnkeates      i have it in my build scripts
  66. # 19:07 ohcanada        then you are a clown also
  67. # 19:07         johnkeates  boops his nose
  68. # 19:08 stakcrops       i use chmod -R too, because all files need to be root owned but i build them as reg user
  69. # 19:08 stakcrops       :P
  70. # 19:08 ohcanada        do you mean chown -R ?
  71. # 19:08 johnkeates      i use it on web app deployments to make sure everything is read-only
  72. # 19:08 stakcrops       oh yeah
  73. # 19:08 stakcrops       i do
  74. # 19:08 stakcrops       :(
  75. # 19:08 ohcanada        another clown
  76. # 19:08 johnkeates      hah
  77. # 19:08 johnkeates      clown -R
  78. # 19:09         stakcrops  honks fake red nose
  79. # 19:09 johnkeates      wait a sec, i don't use chown -R, i use glob+loop+chmod
  80. # 19:09 DSKrepps        Thanks anyway guys.
  81. # 19:09 johnkeates      but it's basically the same
  82. # 19:09 johnkeates      np
  83. # 19:09 johnkeates      you learned something today!
  84. # 19:10 ohcanada        johnkeates: chmod -R affects both files and dirs, and it is never ever what you really need, except by sheer luck
  85. # 19:10 johnkeates      i use a glob with a file extension
  86. # 19:10 DSKrepps        Mostly learned to question weird commands digitalocean tells me to run.

Replies to I broke sudo rss

Title Name Language When
Some Useful Pointers For Sleep Apnea Sufferers LarryPof cil 1 Year ago.
captcha