3

I'm running this command:

cleber@ubuntux:~$ find . -name "*log*" -name "*2016*"
./log-2016-05-04.txt
./log-2016-05-03.txt
./log-2016-05-08.txt
./log-2016-05-02.txt
./log-2016-05-05.txt
find: ‘./.cache/dconf’: Permission denied
./log-2016-05-01.txt
./log-2016-05-06.txt
./log-2016-05-09.txt
./log-2016-05-07.txt
./log-2016-05-10.txt
find: ‘./.dbus’: Permission denied

Why am I getting the "Permission denied" error? All my permission setting on /home/cleber are set correctly. Someone can help me? Thank you.

9
  • @George It's not a good idea to excursively change permissions in system generated folders. Many of them requires restricted rigths to function correctly.
    – Soren A
    Dec 21, 2016 at 13:38
  • 4
    @George chmod 777 is like Vodka, first you think it solves all your problems, but soon you'll wake up with a massive headache. Avoid it.
    – Byte Commander
    Dec 21, 2016 at 13:41
  • If he has issues in his / that's a different matter but in his /home directory it should be so. All files and folders there should be accessible to the owner [in this case Holanda]. Dec 21, 2016 at 13:42
  • 1
    @ByteCmmander, yes I was using that as an example as to how to use -R option to set permissions deep in the folder not asking he use that. Holanda please take note. Dec 21, 2016 at 13:43
  • 1
    @Videonauth, Yes I felt that way too that's why I got rid of it, lest some one uses it. Dec 21, 2016 at 13:54

1 Answer 1

8

Looks like you have some folders with incorrect owners (or maybe permissions) in your home directory.

The Permission denied warning means that find could not search in a specific folder because it did not have the permissions to list its content, obviously.

In your home directory, the most likely cause is that you were running some GUI applications with sudo that messed up file ownerships. To fix this and make you the owner of all files in your home directory again, run this:

sudo chown -R $USER ~

Otherwise, if you are sure all permissions and ownerships are correct and you don't want to modify anything, you can also just hide the warning from the output by appending a STDERR redirection to /dev/null to your find command:

find . -name "*log*" -name "*2016*" 2> /dev/null
2
  • Do all files and folders (including ~/.cache/dconf) in the home folder should be owned by the user (in a freshly installed operating system)?
    – Porcupine
    Sep 23, 2019 at 14:04
  • @Nikhil Yes, that's my understanding. I don't know of any exception so far.
    – Byte Commander
    Sep 23, 2019 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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