The cause of this issue is the same in all cases. You have a directory configured to restrict access and are then trying to get into it from an account that doesn’t have the right permissions. Fixing this is as easy as logging into a different account or changing folder permissions.
Method 1: Changing Accounts to Access Directories
Try to access the folder you were attempting to get into. If you attempt to cd into it from the command prompt, then you’ll get a command that reads something like bash: cd : Permission denied. You’ll receive a similar error if you attempted to access the directory from a graphical environment.
In this case, we were attempting to access the /lost+found directory, which is locked out for access by everyone except for the root user in most Linux installations. Back in the terminal, type sudo -i and push enter. You’ll be prompted for your password, but you’ll then have a root login shell. You can cd into the directory and look around, but please keep in mind that you’re operating from a root shell and can therefore be very destructive. If you’d prefer to stay at your usual account, then try sudo ls /lost+found to see what’s in that directory without having to run the sudo -i command. You can replace /lost+found with the name of any directory, including the /root directory. Keep in mind that prefacing commands with sudo can still permit you to destroy nearly anything.
Method 2: Changing the Default Permissions on a Folder
The first method is extremely simple and works with any folder that you only want to have a look at for doing system maintenance or something similar. However, you might want to explore other options if you’ve wanted to make regular users capable of accessing a folder even if they’re on a server or network. Run sudo chmod -R 755 /path/to/folder, replacing the path with the actual path of the directory you want to make accessible. Once you have, try accessing it from a regular user account. This is slightly more complicated than the above method, but it’s safer and more permanent since it won’t require use of the root account after the first time. In most situations, you can create directories from the start with these permissions. Try using mkdir -m 755 to set it to permit red, write and execute for user with read and execute for others. In either case, you could instead use 777, which would give everyone logged into the file structure the authority to do as they wished with said directory. While there are cases where you’d want to do this, such as on removable storage to move files between two machines manually, think carefully about whether or not this is smart if you’re doing it on a local file system. Using the -p flag instead gives the new directory whatever permissions are considered default, which is usually how running it bare will work as well. You can make sure that files have the right permissions when copying them too. Try using rsync –perms –chmod Fu+w if you’d like to give write permission to the owner for files. You can specify other combinations too. You can use –chown= with rsync, followed by a user name, a colon and their group so copied files end up getting the correct assignments as well. Since rsync is very useful for copying POSIX-compatible file structures between Windows and Linux, you may want to experiment with a few different chmod configurations while using it. One other command you may be interested in trying is install. Run install -m 777 followed by the origin and destination for a file to give it instant read and write access for everyone. You could use 755 or any other combination for safety’s sake. This certainly isn’t as fast as rsync, but it might work for situations where you want to specify permissions exactly to fix “you don’t currently have permission to access this folder” types of errors.
How to Fix ‘Forbidden - You Don’t Have Permission To Access / on this Server’ on…How to Fix “It looks like you don’t have permission to save changes to this…SOLVED: The folder “iTunes” is on a locked disk or you do not have write…How to Fix ‘The Application-Specific Permission Settings do not Grant Local…