Ubuntu – Permission denial for the own folder (theName) inside home folder

command linedirectoryhome-directorypermissions

When we enter any existing directory using the terminal in Ubuntu, the first few unique characters of the name of the directory is enough to type and then to hit the Tab. This successfully happens for my /home/ directory but not for the directory inside it.

The directory inside /home/ is in my name i.e /home/dheeraj/ and this is the only directory present in /home/.

So when I enter /home/ and hit Tab, I am supposed to automatically enter /home/dheeraj/ ,which happened until this morning!

Just to test this, when I do ls in /home/
it says:

**ls: cannot open directory .: Permission denied**   

WHHYYY???? 🙁

At the same time, when I do sudo ls it asks me for the password and then shows me the dheeraj directory. So at-least I can access this directory for now, but why do sudo every time? I need some help figuring this out.

I can't access my home folder when I hover my mouse to the file manager and click on home folder. It says I don't have the permission to access. The same problem even with the root folder. In fact, there's a grey coloured cross displayed on these folders. I'm not sure about the root folder but the home folder is SUPPOSED TO BE ACCESSIBLE by me.

Also, using chmod and changing the privileges did not help!

HINT: I think I used chown earlier today in order to do something else, and I think that created this issue. I have to reverse this whole thing somehow, else it's going to be really inconvenient. I looked up a lot of forums and tried to find answers. It definitely helped me get a vague idea about this, but I'm not able to resolve it.

Best Answer

You need sudoevery time because you cannot read the folder with your dheeraj user.

First regain ownership of your home, but only the directory (not -R), then show us the result of the ls -la to see how far the issue went.

chown dheeraj:dheeraj /home/dheeraj/
chmod 750 /home/dheeraj/
Related Question