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.

Sometimes ago i experienced couple of errors in my Ubuntu 12.10 and i was getting the permission denied error in a lot of Softwares. Finally i found the solution. I found out that a lot of the files in my system including the files and folders in the "home" directory like "pictures" "desktop" "music" and other folders are set to "www-data" in the permission tab when i click on every and each one of those folders and files i right clicked on and then clicked on properties. So one solution is to become root in nautilus and then change that "www-data" to "user-name" in every file or folder, but it will take a long time for me to do that. So my question is, is there any easier way to make "user-name" default again?

after i ran this command:

find /home/{username} -user www-data | xargs sudo chown {username}

i got these errors:

amirrazor@ubuntu:~$ find /home/amirrazor -user www-data | xargs sudo chown amirrazor
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
[sudo] password for amirrazor: 
chown: cannot access `/home/amirrazor/test': No such file or directory
chown: cannot access `piano.wma': No such file or directory
chown: cannot access `/home/amirrazor/Ubuntu': No such file or directory
chown: cannot access `One/Shared': No such file or directory
chown: cannot access `With': No such file or directory
chown: cannot access `Me': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/f_000003': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/f_000007': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/f_000002': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/data_1': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/f_000004': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/index': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/data_2': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/f_000006': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/f_000001': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/data_3': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/f_000005': No such file or directory
chown: cannot access `/home/amirrazor/old_Media': No such file or directory
chown: cannot access `Cache_000/data_0': No such file or directory
share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

If Bob wants to own all the files on his home folder:

sudo chown -Rc bob:bob /home/bob
  • R means recursive.
  • bob:bob is the user:group for Bob, which usually have the same name

Some system files in the home folder are not meant to be owned by the user but a reboot should recreate them.

share|improve this answer
    
Be warned that this follows symbolic links. There's probably a symbolic link in /home/bob/Examples pointing to /usr/share/example-content which should be owned by root. –  ASalazar Feb 8 '13 at 17:08
add comment

You could do something in bash easily enough, if you're not concerned about loosing www-data as the owner of files.

sudo find /home/{username} -user www-data -exec chown {username} "{}" \;
share|improve this answer
    
i got error when i ran this command in terminal, i will add it to my question. –  AmirRazoR Feb 8 '13 at 16:36
    
I forgot about whitespace. Try again with the edited command. –  cduffin Feb 8 '13 at 16:42
    
type the name of the username in those second braces? –  AmirRazoR Feb 8 '13 at 16:46
    
Yep, just stick in you username: –  cduffin Feb 8 '13 at 16:50
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.