Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 22364  / 3 Years ago, sun, may 9, 2021, 8:17:47

I'm trying to find out the default ownership & permissions for my ubuntu install. I'm also trying to figure out whether the wrong-headed granted of file ownership to the user robert to system files is an irrecoverable error. Is it too complicated to try to undo what I have done for my system and just reinstall?



First, some background. I think I made the wrong command when I was trying to change the permissions on a 2nd ext4 drive which formerly had ubuntu installed on it. I must have inadvertently made changes to my current / directory without realizing it. Symptoms of the problem is that I no longer have sudo access on my current system.



robert@robert-KJ379AA-ABA-a6400f:/$ sudo ls -al
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin


I see that "robert" now owns all the files inside /etc: Examples:



drwxr-xr-x   3 robert root    4096 Apr  9 12:27 firefox
drwxr-xr-x 4 robert root 4096 Aug 23 2012 fonts
drwxr-xr-x 3 robert root 4096 Aug 23 2012 foomatic
-rw-r--r-- 1 robert root 766 Apr 11 12:39 fstab
-rw-r--r-- 1 robert root 664 Apr 9 11:26 fstab~
drwxr-xr-x 2 robert root 4096 Mar 29 2012 fstab.d
-rw-r--r-- 1 robert root 664 Apr 11 12:36 fstab.original
-rw-r----- 1 robert fuse 216 Oct 18 2011 fuse.conf
-rw-r--r-- 1 robert root 3343 Apr 19 2012 gai.conf
drwxr-xr-x 5 robert root 4096 Aug 23 2012 gconf


Here are the permissions and ownership for the / directory



drwxr-xr-x  25 root   root    4096 May  5 15:26 .
drwxr-xr-x 25 root root 4096 May 5 15:26 ..
drwxr-xr-x 2 robert root 4096 Apr 10 22:55 bin
drwxr-xr-x 3 robert root 4096 May 5 15:26 boot
drwxr-xr-x 2 robert root 4096 Apr 9 11:30 cdrom
drwxr-xr-x 15 root root 4560 May 5 17:28 dev
drwxr-xr-x 150 robert root 12288 May 5 17:45 etc
drwxr-xr-x 3 robert root 4096 Apr 9 11:37 home
lrwxrwxrwx 1 robert root 33 May 5 15:26 initrd.img -> /boot/initrd.img-3.2.0-41-generic
lrwxrwxrwx 1 robert root 33 Apr 9 12:26 initrd.img.old -> /boot/initrd.img-3.2.0-40-generic
drwxr-xr-x 22 robert root 4096 Apr 24 16:58 lib
drwxr-xr-x 2 robert root 4096 Apr 24 16:58 lib64
drwx------ 2 robert root 16384 Apr 9 11:26 lost+found
drwxr-xr-x 5 root root 4096 May 5 17:28 media
drwxr-xr-x 2 root root 4096 Apr 19 2012 mnt
drwxr-xr-x 2 root root 4096 Aug 23 2012 opt
dr-xr-xr-x 198 root root 0 May 5 12:26 proc
drwx------ 8 root root 4096 Apr 17 02:11 root
drwxr-xr-x 23 root root 820 May 5 17:43 run
drwxr-xr-x 2 root root 4096 Apr 24 16:58 sbin
drwxr-xr-x 2 root root 4096 Mar 5 2012 selinux
drwxr-xr-x 2 root root 4096 Aug 23 2012 srv
drwxr-xr-x 13 root root 0 May 5 12:27 sys
drwxrwxrwt 10 root root 4096 May 5 19:37 tmp
drwxr-xr-x 10 root root 4096 Aug 23 2012 usr
drwxr-xr-x 14 root root 4096 May 5 17:26 var
lrwxrwxrwx 1 root root 29 May 5 15:26 vmlinuz -> boot/vmlinuz-3.2.0-41-generic
lrwxrwxrwx 1 root root 29 Apr 9 12:26 vmlinuz.old -> boot/vmlinuz-3.2.0-40-generic
drwxrwxr-- 1 robert robert 4096 Apr 9 01:37 windows1


Can anyone confirm that "robert" must not own any of these directories just below root? Is there anything here to suggest that the problem may be easy to recover from? If yes, do you have any advice or resources for how to fix this? Thanks.


More From » permissions

 Answers
6

To make root owner of everything in /etc:



sudo chown root:root -R /etc


You will need to boot a live cd and run



sudo chown root:root -R /media/$USER/*/etc


You will need to open the folder in the file browser to mount the disk


[#31362] Monday, May 10, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eighethod

Total Points: 358
Total Questions: 112
Total Answers: 119

Location: Cayman Islands
Member since Fri, Mar 4, 2022
2 Years ago
;