Permission denied when I try to cd into any folder

I recently did a fresh install of Ubuntu 16.04. When trying to cd into any folder in my home directory I get the following:

bash: cd: Documents: Permission denied

I ran ls -lstr and this was the result:

4 drw-r--r-- 2 jessikwa jessikwa 4096 Jan 18 22:09 Videos
4 drw-r--r-- 2 jessikwa jessikwa 4096 Jan 18 22:09 Templates
4 drw-r--r-- 2 jessikwa jessikwa 4096 Jan 18 22:09 Public
4 drw-r--r-- 2 jessikwa jessikwa 4096 Jan 18 22:09 Pictures
4 drw-r--r-- 2 jessikwa jessikwa 4096 Jan 18 22:09 Music
4 drw-r--r-- 2 jessikwa jessikwa 4096 Jan 18 22:09 Documents
4 drwxr-xr-x 3 jessikwa jessikwa 4096 Jan 20 23:36 projects
4 drwxr-xr-x 2 jessikwa jessikwa 4096 Jan 20 23:56 Downloads
4 drw-r--r-- 2 jessikwa jessikwa 4096 Jan 20 23:58 Desktop
4 drwxrwxr-x 5 jessikwa jessikwa 4096 Jan 21 00:04 Simplify3D
4 drwxrwxr-x 5 jessikwa jessikwa 4096 Jan 21 00:32 ~.npm-global

(In a hurry I had ran chmod 755 on my Downloads and projects folder.)

This hasn't happened to me before; why don't I have permission by default? Is there a way to quickly fix it?

2 Answers

Possible cause

The most probable cause is running chmod -R, which is almost always a bad idea.

With reinstall

Whatever caused the problem might have done who knows what, so it might be best to try reinstalling. Check right after that the permissions are set properly. If they aren't, perhaps your install media is bad (check the checksum on the ISO file) or your hard drive is bad (do a SMART test in the hamburger menu of the Disks application).

Without reinstall

You can make all folders accessible to you by setting them executable for you, which is what allows you to cd into them. In a terminal, use find to locate all the directories under your home directory (~), then use chmod u+x on each directory:

find ~ -type d -exec chmod u+x {} \;

Note that whatever caused the problem initially might have also made executables (not directories, but programs) within your home directory nonexecutable. Unfortunately, there's no easy fix for that (other than reinstalling), since you can't sanely just willy-nilly set all normal files to executable.

You'll have to set them executable as you come across them by running:

chmod +x path/to/program
1

Your folders need to have an executable bit ('x') set. You can set it with chmod +x Documents.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like