Home permission issue with "ls" command: permission denied
Reply: 1

permission issue with "ls" command: permission denied

ali2569
1#
ali2569 Published in 2018-01-12 11:43:26Z

Although I am the owner (pi) of the directory, still permission is denied

pi@raspberrypi:~/Desktop $ sudo ls -al
total 16
d-wx--x--x  3 pi pi 4096 Jan 12 11:30 .
drwxr-xr-x 21 pi pi 4096 Jan 12 11:28 ..
-rw-r--r--  1 pi pi   82 Jan 11 16:13 cmd.txt
drwxr-xr-x  6 pi pi 4096 Jan 12 11:30 openvibe-2.0.0-src
pi@raspberrypi:~/Desktop $ ls
ls: cannot open directory '.': Permission denied
David Stockinger
2#
David Stockinger Reply to 2018-01-12 11:59:19Z

As you can see in the output of your command, your directory has incorrectly set permissions.

Permissions on directories

Files and directories both have read, write and execute permissions, but they mean different things. For directories, the permissions have the following meanings:

  • r (read) - When present, the content of the directory may be read.
  • w (write) - When present, the content of the directory may be changed. This means files can be created, renamed and deleted. This requires the x flag to also be set.
  • x (execute) - When present, the directory can be set as the current working directory via cd.

More information can be seen here.

How to fix the problem

The default permissions when creating a new directory on most Linux distributions is drwxrwxr-x, which means the owner and group both have permission to read and modify the contents of the directory, as well as cding into it. Any other users may read the contents, but not add any new files.

To do this, you need to execute chmod 0775 ~/Desktop

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.295845 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO