Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change owner of the root folder and subfolders (Ubuntu 13.04) [closed]

I accidentally set owner of root folder (/) and all subfolders to one user by command

$ sudo chown -R 'userName' /*

Now I wanna set owner back to root user by command

$ chown -R root:root /*

But I have no permission for this operation. If i use command

$ sudo chown -R root:root /*

it returns

 sudo: effective uid is not 0, is sudo installed setuid root?

What should I do to fix that?

like image 259
Mikhail Panteleev Avatar asked Jul 03 '13 15:07

Mikhail Panteleev


2 Answers

I am guessing when you ran the first command you also ended up modifying the ownership of the /usr/bin/sudo executable.

It is saying that effective UID isn't 0 (since root has EUID equal to 0).

So try to change owner of /usr/bin/sudo, and then try change the ownership of other files.

like image 137
jaypal singh Avatar answered Oct 05 '22 07:10

jaypal singh


You broke your system pretty badly. Next time be more careful using sudo.

  • Now, start your system using a rescue disk, probably your install disk.
  • Mount your broken file system in the rescue system.
  • Fix the permission/owner stuff.
  • Reboot using your original system.

Depending on how much you changed using that chown, you will have to fix a lot in step 3. You probably might want to have a look at a working proper installation of the same system to find out which user should be the owner of things like /dev/mem etc.

A re-install of the OS might be faster.

like image 35
Alfe Avatar answered Oct 05 '22 06:10

Alfe