Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I check and set who can view or open a given folder or file?

share|improve this question
up vote 7 down vote accepted

To check:

ls -l /path/to/folder/or/file

or for more verbose output:

stat /path/to/folder/or/file

To change owner:

chown someuser:somegroup /path/to/folder/or/file

To change permissions:

chmod 755 /path/to/folder/or/file

man chown and man chmod will give you explanation about the various options.

Or, if you are using some graphical environment, such as Gnome, you can just right-click the files/folders and set the permissions there.

EDIT: Changed file -> stat. Thanks for correction!

share|improve this answer
This suffices 99% of the time. The other 1% of the time (when access control lists are in use) you need getfacl filename. – Marius Gedminas Jul 30 '10 at 11:21
Marius: And for the 0.01% of the time (when SELinux security contexts are in use) you need to use -Z flag for various commands, such as ls, to see the SELinux flags. – Janne Pikkarainen Jul 30 '10 at 11:24
file doesn't show anything about permissions. Perhaps you meant stat. Also, some people find symbolic permissions to be more intuitive: chmod u+x,g=rx,o-w abc or chmod ugo=r abc – Dennis Williamson Jul 30 '10 at 14:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.