Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I accidentally changed permissions to root directory on my system and now my system won't boot, I tried to fix packages from grub recovery and check file system but nothing. Here's the code I accidentally typed:

     sudo chown -hR jmayerz:jmayerz /

After it executed, X11 shut down and system got stuck, so I rebooted and it won't boot again. I tried changing back permissions to system superuser from liveCD but how can I change it to the user on the machine itself not the liveCD? like this:

     sudo mkdir /media/mount
     sudo mount /dev/sda1 /media/mount
     sudo chown -hR <user which originally owns root on the machine itself not liveCD, I think root user> / 

How would that last line be executed?? which user is it?? and how is this executed from livCD?

When I try to use that method in recovery, it tells me that files are read-only, when I try to perform tasks that mount root in read-write it still doesn't do it.

     mount -ro remount,rw

says that /etc/fstab reports that directories are already mounted.

     chown -hR root /

says that files are in read only mode, after mounting read-write through doing something like fixing packages, it doesn't output anything.

     chmod -hR jmayerz:jmayerz /home/jmayerz/

same thing.

And now the liveCD won't boot, says general filesystem mount error.

share|improve this question

1 Answer 1

There's always a user called root in Ubuntu, and its User ID is always 0. When using chown you can specify either user name or user ID, so I suppose both of the following commands should work when booted from a LiveCD:

chown -hR root:root /media/mount
chown -hR 0:0 /media/mount

after which I think you'll need to change the ownership of home directories - you'll have to use user IDs in this case because users from your machine do not exist when booted from LiveCD. You can see what was the user IDs of the users in your system by looking into /etc/passwd on the hard disk (so, in your case it'll be something like /media/mount/etc/passwd)

share|improve this answer
    
Ok, so what exactly should I do next? there are many other users like sudo as well, and would some sort of uuid make a difference? how would the root user on the machine itself not the liveCD be defined as owner? is it the same signature? I can't find the ID of the user I use, jmayerz. It's not in that table, and the file I found is at /usr/share/base-passwd/passwd.master and /group.master not at /etc/passwd –  Jack Mayerz Nov 5 '12 at 0:18
1  
"ownership" of a file is defined by just 2 numbers stored in the file's metadata, which represent user_id and group_id. There is no difference between root on this machine and root on another machine (or in a LiveCD session) because it's user ID is always 0. This is different from other users, which IDs generally depend on the order in which the users were created. The ID of the first user added to an Ubuntu system is usually 1000. To find the actual UID you need to check /etc/passwd on the hard disk, not on LiveCD, so the path will be something like /media/mount/etc/passwd –  Sergey Nov 5 '12 at 1:38
1  
I should also mention that, apart chown-ing everything to root and then changing the ownership of the home directories, there likely to be some (a few? numerous?) system directories which require specific ownership. You'll have to track them down and fix individually. If you're not finding the experience enjoyable and educational you may consider backing up your data and making a clean install. –  Sergey Nov 5 '12 at 1:54
    
How do I know which directories I have to change? also, I'm trying to change it from recovery right now instead of liveCD, but when try to, it tells me that directories are in read only mode, but even after I perform a task that mounts the directories in read-write like fixing packages, it still doesn't change ownership and it just doesn't do anything, not even providing an error. –  Jack Mayerz Nov 5 '12 at 1:59
    
And when I attempt to access my account from tty it doesn't. Somehow I'm stuck at boot at the ubuntu logo screen but I can access tty sessions, when I type my password to login it doesn't, what's the fix for this? Or how can I change my root password without logging in? Or any other user to login with?? –  Jack Mayerz Nov 5 '12 at 2:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.