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.

Which directories in the hierarchy does the default main user (UID 1000) own? like maybe /usr/share/ or /bin/ I need to now exactly the directories my user needs to own in the hierarchy, in short I made a mistake, details here:

12.04 LTS won't boot after modifying root directory permissions

And specifically which files handle the sudo command, as when I try to use it from tty it reports an error, sudo: need to be root to perform operation

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

CD to the directory you want to search and use the find program:

find -uid 1000

You can find out any user ID with id:

id <username>

On my system (12.04) the sudo program is at /usr/bin/sudo and has the "Set UID" bit (permissions -rwsr-xr-x). This command might fix it, if you run it as root:

 chmod u+s /usr/bin/sudo

Every user should own just their home directory, with everything else being owned by root. One exception is files inside /tmp, which are owned by the user that created them. However, /tmp itself is owned by root, but is writable by anyone (permissions 777).

The other exception is files inside /proc, but the contents of this directory are created by the kernel and you don't need to alter the permissions of anything inside.

To fix permissions, boot into recovery mode, CD to /, and run:

chown root:root -R *

Then CD to /home and fix each home directory:

 chown <user>:<user> -R <home_dir>
share|improve this answer
    
Wouldn't the find script, bring up the files owned by UID 1000?? Well, I changed that; sudo chown -hR jmayerz:jmayerz / was the command I accidentally typed. What I need to know is what files in the hierarchy does the user own by default so I can change ownership of everything else to root except for these. Could you find that out for me on your own system? –  Jack Mayerz Nov 5 '12 at 23:07
    
Basically, I just own my home folder. Check out my updated answer above. –  Kalle Elmér Nov 6 '12 at 10:49
add comment

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.