Cannot change directory into home directory, although permissions are set correct
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.
Related videos on Youtube
Sebastian S.
Updated on September 18, 2022Comments
-
Sebastian S. over 1 year
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 messageNo 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
-
Volker Siegel almost 10 yearsWhat are the permissions on
/home
? Maybe there is ax
permission missing for a directory?ls -ld /home
-
-
Sebastian S. almost 10 yearsRight! 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 asudo chmod u+X /home
the problem could be fixed. Thanks a lot!