I have a directory that have the r permission bit:  dr-------- 3 robert robert 4096 2017-12-17 03:47 dir   This directory have two files and one directory:  file 1.txt  file 2.txt  subdir   When I run the command ls dir (from the robert account), I get an error alongside the content of the directory:  ls: cannot access dir/file 1.txt: Permission denied ls: cannot access dir/file 2.txt: Permission denied ls: cannot access dir/subdir: Permission denied file 1.txt  file 2.txt  subdir   Why ls displayed an error even though it also displayed the content of the directory without any problem?
5264
In my CMS, I noticed that directories need the executable bit (+x) set for the user to open them. Why is the execute permission required to read a directory, and how do directory permissions in Linux work?
113805
Recently back to Linux from another operating system I noticed a file called [ which seems strange to me.  What is it for?  $ ls -l /usr/bin | head -2 -rwxr-xr-x 1 root root       39552 Nov  3 14:44 [   I'm using Ubuntu 15.04
22565
Why does redirection, using sudo give me an error for the following commands?   $ sudo printf "foo" &gt;/etc/file bash: /etc/file: Permission denied  $ sudo printf "foo" ~/file; cat ~file &gt;/etc/file  bash: /etc/file: Permission denied   ...yet I have no such problem when I use an editor, or cp. I don't think I've ever tried this before, so I don't know if there is something haywire on my system, or if this is normal. It seems a bit restrictive to be normal, but(?) maybe it is intended to be restrictive...  (using Ubuntu)
98162
I need to generate a file list from a disk volume. Some of the directories (all hidden directories under the root directory) have strange permissions that causes find to complain.  I try to exclude all these paths, but one directory still complains:  find . -type f -not -path './.*/*' find: ./.DocumentRevisions-V100: Permission denied   The rights are like this (set so by the operating system, so I assume they shouldn't be messed with).  d--x--x--x root  wheel   .DocumentRevisions-V100   How do I change the find statement to effectively omit all the hidden directories as to not complain. (I do not want to do 2&gt;/dev/null as I want to know about other problems).
83301
I'd appreciate help with a couple questions regarding standard file permissions. Assume that I'm not using access control lists.     If a file is associated with multiple groups, must all groups have the same permissions?   If the group permission includes write access, can any member of any group the file is associated with change the file permissions? Can such a person change the file owner?   Say now the file permission is rwxr----- (owner can do everything, but group members can only read). I am in the group associated with the file. I am also the file owner. Which permission am I granted? Read-only, or rwx?
70598
So I was working and there was a directory that I was periodically changing to my user in  a root terminal so that I could open the files in text editors, but I accidentally pressed / instead of . and this was the command I put out:  chown -R emil.emil /   Then immediately panicked ^C and put in another command, as I thought I could always change back the files I needed to access:  chown -R root.root /   So now I can't do su from emil to even try to fix this, as I'm getting permission denied error. I'm on Ubuntu could someone tell me if there is a way I could fix this, without absolutely reinstalling the whole thing.  TIP  If you are trying to get root access, and are getting this permission denied error when using su try this command:  gksu gnome-terminal   It will prompt you for the root password and open a new root terminal for some reason this works and gives me root access, when su doesn't.
59576
I am writing code that checks for the permission to write to and delete from certain directories. The first is fairly easy. To whit:  FileIOPermission writePermit = new FileIOPermission(FileIOPermissionAccess.Write, _ArchiveHome); writePermit.Demand();   But, how do I do the same for permission to delete from a given directory?
34236
I have an external HDD and I kind of messed up the file permissions but when fixing it I thought it is ok bc with my username I can access the files perfectly fine. Now that I use this with two PC (actually ATM I don't have access to my other PC) I can't access these files.  The problem is this directory has hundreds of folders with no permission for "everyone". I would like to give it the default permissions including have all access for the user "everyone". How do I do that via command line for these hundreds of folders?
30210
If I have two users called john and sally. Both are part of the users group. john creates a directory with permissions 775. sally then puts a file there with 644 permissions.  Even though the file obviously has no group write privileges. Can john then modify/delete that file in the directory he owns but the file he does not own?
23751
I want to create a simple bash-script that checks whether a directory contains all the files whose names contain numbers from 1 to N.  # Creating some files for testing $ cd /tmp/ $ mkdir test $ touch test/a01x.dat $ touch test/b02y.dat  # Display dir contents $ ls test/*{01,02}* test/a01x.dat  test/b02y.dat   But using seq command to generate numbers results in the following:  $ ls test/*{$(seq -s , -f "%02g" 1 2)}* ls: cannot access 'test/*{01,02}*': No such file or directory   I understand that running the command by surrounding the path with single quotation marks must lead to the error because the wildcards don't expand  $ ls 'test/*{01,02}*'   But I didn't use them. What is the problem?
7868
Let's say I have a file called run.sh that contains:  #! /bin/sh -x  x-www-browser index.html   And ls -l run.sh says:  -rwxr-xr-x 1 myusername myusername 39 Jan  9 19:32 run.sh   And ./run.sh says:  bash: ./run.sh: Permission denied   Why does it not work? Why does sh -x run.sh work perfectly?    More info, since it's not so easy apparently  If I do a sudo, it will not output an error, but won't do anything either.  myusername@crunchbang:/mnt/data$ sudo ./run.sh [sudo] password for myusername:  myusername@crunchbang:/mnt/data$
106969
In Ubuntu 18.04, I can create a file as one user in /tmp, and write to it as user root (despite the sticky bit being set on /tmp). In Ubuntu 20.04, I get a Permission Denied error as user root. Ubuntu 18.04: # As user &quot;ubuntu&quot;: touch /tmp/tmplock  # As user &quot;root&quot;: echo &quot;foo&quot; &gt; /tmp/tmplock  cat /tmp/tmplock # Outputs &quot;foo&quot;  ls -lah /tmp drwxrwxrwt 32 root   root    20K Jun 16 18:36 . -rw-rw-r--  1 ubuntu ubuntu    4 Jun 16 18:36 tmplock  Ubuntu 20.04: # As user &quot;ubuntu&quot;: touch /tmp/tmplock  # As user &quot;root&quot;: echo &quot;foo&quot; &gt; /tmp/tmplock # Outputs: bash: /tmp/tmplock: Permission denied  ls -lah /tmp drwxrwxrwt 12 root   root   4.0K Jun 16 18:15 . -rw-rw-r--  1 ubuntu ubuntu    0 Jun 16 18:14 tmplock  I can't find any information on if this is related to the sticky bit, or an underlying Linux kernel change, or anything. Does anyone know what can explain the change in behavior?
8399
i wanted to know the Read / Write Access on to a file , so i did this way   ls -l Denem.sh   This command displayed   -rwxr-xr-x  1 pavan employee 672 DEC 20  2000 pavan.sh   Could anybody please tell me what -rwxr-xr-x  indicates ?? From Wikipedia.com i found that  -rwxr-xr-x  indicates     -rwxr-xr-x   for a regular file whose user class has full permissions and whose group and others classes have only the read and execute permissions.   Now my  question is Should we take the middle thing (-xr-) into considiration ??
48702
The output of ls -l command yields the following result:    What is the number field between file permission and owner? i.e. what are those 1, 1, 1, and 2? I checked the --help but that doesn't explain it.  [EDIT]  I thought it was the number of files in a directory but it isn't. See image. "tempFolder" has 3 files but still show a "2"
18506
See Also:          I changed file permissions recursively on the root directory / by executing sudo chmod -R / 777, and after that my system won't boot (I'm getting a lot of "permission denied" errors).  Please help.
94820
Symbolic link not working, using standard UBUNTU 16 LTS... It shows "Permission denied" where I expected to get access, not working even after chown.  Full example:  sudo rm /tmp/file.txt  # if exist, remove  cd ~ sudo chmod 666 data/file.txt ls -l data/file.txt    # "-rw-rw-rw-" as expected more data/file.txt     # working fine sudo ln -sf $PWD/data/file.txt /tmp/file.txt  # fine ls -l /tmp/file.txt    # "lrwxrwxrwx",  /tmp/file.txt -&gt; /home/thisUser/file.txt more /tmp/file.txt     # fine  sudo chown -h postgres:postgres /tmp/file.txt  sudo more /tmp/file.txt   #  NOT WORK! but its is sudo! and 666!
92926
I've been trying to find the difference between using the dir and ls commands in terminal. I know ls is the traditional UNIX method of viewing the files in a directory, and that dir is the windows command prompt equivalent, but both commands work in terminal.   If I type in dir, it displays the files and folders in the directory, and if I type ls, it does the same, except with content highlighting. Both commands accept options (i.e. ls -a and dir -a both return all files and folders and hidden files.   So does anyone know what the difference is and why both dir and ls are used?