Noob permissions question.

Permabanned
Joined
5 Jun 2010
Posts
15,459
I have managed to change the owner and group of a directory but some of the files are not executable for a user I have created.

What is the syntax to give execute permissions for all the files and files in the sub directory for a user?
 
Two ways with chmod, one is to do:

chmod +x somefile

Better way to do it is with the numbers method:

chmod 700 somefile

It's broken down into the 3 digits, first digit is the user, second is the group, second is everyone else. That number is made up by adding the permissions needed together:

4 = read
2 = write
1 = execute

So 700 = rwx for the user owner of the file and nothing else.
644 = rw for user owner, read for group, read for everyone else.
755 = rwx for user owner, rx for group and everyone else.

Hopefully that makes sense! :)
 
to make it executable for the file owner: chmod u+x the_file
to make it executable for members of the file group: chmod g+x the_file
to make it executable for just everyone else: chmod o+x the_file
to make it executable for all three: chmod +x the_file
to make it not executable for all three: chmod -x the_file

simples, the same works with making (+) or unamking (-) it excecutable (x), readable (r) and writable (w) for owner (u), group (g), others (o) and all (nothing or a).
 
Back
Top Bottom