Give linux file read and execute access for all users

I have been trying to give a script read and execute access to all users. It is used as a set up script for a lab for COMP 322. Here are the steps

There are two modes, octal mode and symbolic mode. The symbolic mod is much much easier to remember.

Set the group of people you want to give access to,

Reference Class Description
u user the owner of the file
g group users who are members of the file’s group
o others users who are neither the owner of the file nor members of the file’s group
a all all three of the above, same as ugo

 

In my case, since I am trying to give access to all the students, the group is “a”, for anyone.

Then I need to determine what kind of access I want to give to the students. Before that, I need to choose an operator,

OperatorDescription

+adds the specified modes to the specified classes

-removes the specified modes from the specified classes

=the modes specified are to be made the exact modes for the specified classes

 

In this case, I choose + to give additional access modes to the file,

Finally, to specify what kind of write I want to give to the file. The basic ones are r, w, x and read, write and execute, the documentation is here

r read read a file or list a directory’s contents
w write write to a file or directory
x execute execute a file or recurse a directory tree

 

The command in the end is

chmod a+rx targetFile

you can check the rights set up for the file doing the following command:

ls -l targetFile

you will see

-rwxr-xr-x

which means rwx for the user (me), r-x for the group, r-x for others. (Break it into groups of three). 

 

Sources from wikipedia

http://en.wikipedia.org/wiki/Chmod

Advertisements
This entry was posted in Tools. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s