Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 1

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
2  
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
1  
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
add comment

Your Answer

 
discard

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.