1

I did the command by accident whilst trying to fix things not being able to upload files anywhere and now some of my software is refusing to open, including the software centre itself, I'm newish to Ubuntu so I'm not super sure of what I'm doing, definitely learning by my mistakes a bit

  • Don't forget to backup your data. – schrodingerscatcuriosity May 02 '20 at 21:13
  • Yeah, all my data is fine – drneroli May 02 '20 at 21:15
  • Hi and welcome to AskUbuntu. It would be too hard to undo what you did there, albeit not impossible (e.g. by using the information from the .deb files). I suggest you restore from a backup or backup your data and reinstall. In future you may want to consider the use of the mnemonic form of the file modes. There are things that numeric (octal) file modes can't even express, for example +rwX. So this helps being more aware of what you're doing. Also when using sudo always make sure to stop and think about what you're doing. – 0xC0000022L May 02 '20 at 21:17
  • To add to my previous comment. The suggested other answer also uses octal file modes. And the shortcoming is immediately evident from the answer. Sure, you could use find with the -type predicate to execute chmod on files or folders with different modes. However, you could also use the uppercase X mnemonic file mode and be done with it. As it means "set x for directories only". – 0xC0000022L May 02 '20 at 21:21
  • 2
    I have reinstalled Ubuntu from scratch so everything works now, I am definitely going to have to learn alot before I go willy nilly with commands but there's alot amiss that I need help with, i'll be asking alot of questions on here... – drneroli May 02 '20 at 21:30
  • @drneroli if I may make a suggestion, if you want to fiddle with things in a safe environment, then within your Ubuntu installation install VirtualBox and spin up a VM of Ubuntu that you can mess around with to test various commands, functions, etc. That will protect you from having to reinstall your main system over and over again, as the VM is self-isolated from the main computer. – Thomas Ward May 03 '20 at 19:55
  • If I should need to i'll definitely give that a go, yeah. So far, apart from a couple of small issues I need to fix that shouldn't end up breaking everything ever, hah, I should be ok – drneroli May 03 '20 at 20:16

1 Answers1

4

Doing what you did has effectively has broken your system in an irreparable way. Given that you admittedly are 'newish' to Ubuntu, then you'll have to reinstall to fix the permissions. (To fix the permissions manually will be a days-on-end process and will take a LOT more knowledge than you have about Ubuntu, and it is effectively faster for you to reinstall than try to fix the issue.)

NEVER run recursive chmod on the root - it's basically making your life hell, and on this site there's no way to restore your system to working without a reinstall.

And unless you really understand what a command does, don't randomly execute commands with sudo access.

Thomas Ward
  • 74,764
  • And I would add NEVER on systems' folders, and in /home very carefully. – schrodingerscatcuriosity May 02 '20 at 21:11
  • 1
    Yeah, I thought I might have messed up doing it, thankfully I had only just installed it earlier today so it's not as if I've lost alot of progress, I'm going to have to ask alot of questions on here as I'm having alot of problems with this at the mo – drneroli May 02 '20 at 21:13
  • I have to admit I find this answer - with the exception of the last sentence (which should include sudo and/or superuser, though) - a mit meager. In my mind I can come up with two ways to restore the file modes in an instant (use info from .deb files, use a cloud image as template for the correct file modes). Whether they're practical for a newbie is another question, similarly whether the effort is worth it (which would depend on the circumstances), but perhaps that's what your wording with "effectively" is meant to suggest? – 0xC0000022L May 02 '20 at 21:26
  • @0xC0000022L unfortunately, a 'cloud' image only works if they haven't installed other things on their systems. There is no way to really restore every application's settings to the correct state even with a cloud image or .deb files because that's a very tedious and many days long process, and since they changed the permissions on sudo and other directories sudo won't work properly anymore either. Effectively making it impossible to fix that problem. – Thomas Ward May 02 '20 at 21:42
  • @ThomasWard fair enough, so that is what you meant by effectively. apt-mark and dpkg --get-selections options to figure out what was added over a default installation, and unless configuration management is used, debsums -ce can be used to survey the changed configuration files. So indeed it's likely faster for the OP to reinstall (also given the OPs statement ;)). – 0xC0000022L May 02 '20 at 21:49