Cannot change directory into home directory, although permissions are set correct

1

I guess I need some help from an advanced Unix user...

On a Ubuntu System I did something stupid. I typed sudo chmod 774 .* or the like, in a subfolder of my home folder and then I suddenly could not change the directory to my home directory anymore. I'm not quite sure about the exact numbers in the command, but I am sure about the .*.

Now, after a reboot, I can't even log into the GUI anymore and when I Ctrl + Alt + F1 into a console and log in, I get the message No directory, logging in with HOME=/.

When I then try to cd into /home/myusername, I get the error: -bash: cd: /home/myusername: Permission denied. Also, ls can't access the folder.

I checked the permissions of /home/myusername using sudo, and they are all correctly set to:

drwxr-xr-x 25 myusername myusername 4096 Aug 26 17:30 myusername

A testuser, that I created, has the same promblems. It cannot log into the GUI, either. Only a guest session can do it (I guess that is because the guest home folder is created inside /tmp).

What do I need to do, to restore my permissions/get access to my home folder again??? Any suggestions?

Cheers, Sebastian

Sebastian S.

Posted 2014-08-27T09:34:14.947

Reputation: 13

What are the permissions on /home? Maybe there is a x permission missing for a directory? ls -ld /home – Volker Siegel – 2014-08-27T11:58:23.117

@VolkerSiegel There was indeed an x permission missing for world in /home. Seems like this solved the problem! I will report, once I have confirmed that all is functioning. – Sebastian S. – 2014-08-27T12:42:28.530

Answers

1

So, you own your home direcory /home/myusername, and have rwx permissions on it.

But a
cd /home/myusername
gives a Permission denied?

That looks like you are not allowed to look at /home in the to begin with, before it comes to actually looking up myusername in that directory.

With
sudo chmod 774 .*
in /home/myusername, you included the file ...
And /home/myusername/.. is the same as /home.

The permissions were applied as root, so the 4 is what applies to you a a normal user. this is r--, it does not contain the execute permission. On a directory, the execute permission is what allows you to look inside the directory.

The problem applies to all users that have their home directory under /home, as you already found out.

Volker Siegel

Posted 2014-08-27T09:34:14.947

Reputation: 1 188

Right! Since the rights of home were accidentally set to drwxrwxr-- root root 4096 Aug 26 17:30 home, none of the ordinary users could access it. With a sudo chmod u+X /home the problem could be fixed. Thanks a lot! – Sebastian S. – 2014-08-27T12:56:36.840