I have a log/ directory with read permission for all : drw-r--r--
paul#ns387656:/var$ ls -l
...
drw-r--r-- 9 root root 4096 May 22 14:49 log
...
But when I want to access it with the cd command I have a "Permission denied"
paul#ns387656:/var$ cd log
-sh: cd: log: Permission denied
And I don't know why...
Ideas ?
Thx
You need execute permission to change into a directory.
Also the owner is listed first. In this case the owner is root and root has read and write permission. Group and Others have only read permission.
Try this:
sudo chmod a+rx log
This adds read/execute permission for owner, group, and others.
Related
I wonder how one investigates the cause of denied access in a case like that:
uid=0(root) gid=0(root) groups=0(root)
root#host:/tmp# chown root .mount_app
chown: cannot access '.mount_app': Permission denied
root#host:/tmp# ls -la .mount_flameshot
ls: cannot access '.mount_app': Permission denied
root#host:/tmp# stat -c "%U" .mount_app
stat: cannot stat '.mount_app': Permission denied
Addiotional Info:
In this specific case the file is somehow related to snap.
I would like to move the file.txt FROM usr/local/file.txt TO /usr/local/folder/file.txt.
However, every time I try I get a permission denied reply.
I have tried:
sudo mv ~/usr/local/file.txt /usr/local/folder/file.txt
When I got permission denied, I also used chmod and set a 777 just to try and still get permission denied.
What can I do?
Try this:
Check whether you have write access to the folder with
ls -l
Then you can try changing the ownership of the folder to your current user.
sudo chown -R your_username /path/to/folder
See this.
I've ran into a problem after setting a folder and its contents to 755 permissions.
I ran
chmod 755 -R folder/
However, when trying to access in my /var/www folder via the browser I get a 403 Forbidden error.
I did download the folder from the web, but other files with 755 permissions are loaded just fine into the browser. Here is what it looks like:
ls -l
drwxr-xr-x. 4 root root 4096 folder
Edit: If you're going to down vote, how about explain why?
drwxr-xr-x.
The trailing dot means the directory has an SElinux ACL, which is likely the cause of your problem. -- the ACL denies access.
I'm installing Homebrew and when I run brew doctor it prompts:
Error: Permission denied - /usr/local/bin/pkill.pl
I've tried:
$ sudo chmod 755 /usr/local/bin/pkill.pl (also other options: 777, a-x, ...I don't know which is need it for brew)
but when ls, still:
ls: ./pkill.pl: Permission denied
lrwx------ 1 root wheel 23 11 feb 2012 pkill.pl
...
Could you tell me how to solve it? Thank you!
That first character in the directory listing (l) means the file is a symbolic link to another file. Use ls -l to find out which. It's most likely the permissions on that file that are the problem. The permissions for links are normally 755 (read and execute all users and write for owner).
This should work sudo chmod +rx /usr/local/bin/pkill.pl
So I "installed" SBT by following directions here under the "UNIX" section by downloading the jar and creating the sbt script to run it - however instead of putting it in ~/bin/ I put it in /usr/local/sbt/. I added it to my PATH variable and when I try to run it without sudo I get a Permission denied error (below). Also below is what I see when I type in ls -l in the sbt directory.
$ sbt compile
bash: /usr/local/sbt/sbt: Permission denied
-rwxrwxr-- 1 root wheel 120 Jun 20 09:21 sbt*
-rwxrwxr--# 1 adelbertc staff 1096763 Jun 20 09:20 sbt-launch.jar*
Help?
Try changing the permissions so that you can execute it:
sudo chmod o+x /usr/local/sbt/sbt /usr/local/sbt/sbt-launch.jar
Otherwise, you can add yourself to the wheel group, or change the owner so that you own it:
sudo chown adelbertcs:staff /usr/local/sbt/sbt
(assuming that your username is adelbertcs).