Why does nothing work after I randomly changed some file permissions?
Ok so last night i was trying to set permissions to some folders in my File System, since apparently im not an admin on my own computer. And now everything got messed up today and i don't know what to do..
- I lost my internet, the icon is not showing in the taskbar anymore.
- I lost my sound, there is no sound devices listed when i go into the sound menu.
- I can not log into root anymore, it gives me "sudo: must be setuid root"
- I can not plug anything in anymore, it will not recognize flash drives or external hard drives.
- It gives me a Internal Error message everytime i log in
- It doesn't let me log into the Grub screen anymore on boot up.
What did i do? I have a lot of files on here i wish to put on a flash drive but it won't recognize it.
Solution 1:
Sounds as if you changed the ownership and / or permissions of system files.
You can search ~/.bash_history for the commands you ran, and if you post them here perhaps they are easily reversed.
gedit ~/.bash_history
Look for commands such as chown
or chmod
, if they were run with the -R (recursive) option, easier to re-install. If, however, you changed only a few files or directories, recovery is possible.
Often though you will have to re-install as manually fixing permissions is time consuming and imperfect.
In the future see: ubuntu sudo page
Normally you use sudo
or for graphical applications gksu
to perform system administration or edit system files.
Example:
gksu gedit /path/to/file
sudo command
Solution 2:
Sounds like you hosed your system by changing permissions and/or ownership of important system files. Depending on what exactly you did, fixing the system could be easy or hard.
Given that you're not sure what exactly you did that caused this, I'd say a reinstall is probably the easiest option. It is quite likely possible to undo what you did and get your system back to normal, but a reinstallation may take less time to get a working system back.
Nothing you've mentioned so far suggests that your personal files have been removed/compromised, so you should be able to extract your files from your harddrive by booting an Ubuntu Desktop CD/USB, mounting your partition(s) and copying the important files to another media, like a USB stick/harddrive or network share.
Solution 3:
We don't necessarily know everything that's wrong with your system, but we do know one thing that's wrong:
sudo: must be setuid root
sudo
is the primary mechanism used to perform administrative tasks in an Ubuntu system. Its ownership and/or permissions are broken, so it cannot work.
Fortunately, on a desktop Ubuntu system, there is another mechanism used to perform administrative tasks: PolicyKit. So you can usually fix a broken sudo
using the pkexec
command-line frontend to PolicyKit, without even having to boot into recovery mode or from a live CD/DVD/USB. sudo
having the wrong ownership/permissions is not the most common breakage scenario, but it's fixed just as easily. Just open a Terminal window (Ctrl+Alt+T) and run these commands:
pkexec chown root:root /usr/bin/sudo
pkexec chmod 4755 /usr/bin/sudo
Running those commands should fix the permissions on sudo
.
That might or might not fix the basic problem. You can see if sudo
works now by running a harmless command like sudo ls
. You should update your question and/or comment here to provide information about what errors you see next, if any.
Once you regain full access to your system you should do one of two things:
Look at your
.bash_history
to figure out what commands you ran, then update your question so that we can tell you how to undo any other damage that was done. Your system may still be in an insecure or unstable state, even if things seem to be working all right.Or, do a fresh reinstallation of Ubuntu, if you're not able to do that.
Finally, please note:
In a situation where you are actually not an administrator on your own computer, that can be fixed quite easily. Fixing it does not involve changing the permissions on any files. Changing the permissions on files does not fix this.
If you an break your system the way it seems you have--that is, if you can change the ownership or permissions of
/usr/bin/sudo
--then you were definitely already an administrator on your system (unless you booted to recovery mode or from a live CD/DVD/USB to do it). Non-administrators cannot make such changes to an Ubuntu system.Even when you are an administrator on your system, you may see "access denied" and similar messages when attempting to perform some tasks. This does not generally mean that you are unable to perform them, but rather that you are not using the right technique to perform them. In particular, administrator accounts are still limited--you must use something like
sudo
to perform most administrative actions.