First of all allow me to explain the basics of chmod.
Chmod is a Unix command that allows you to set permissions that determine who can access the file, and how they can access it.
You can set these permissions for 3 different categories.
- The owner of the file (User)
- The members of the group that owns that file (Group)
- Everyone else (Others)
There are two ways to modify the permissions:
1) By using alphanumeric characters
The permissions are separated in 3 categories:
You can set the permissions in the following way:
Let's imagine a file called
We want to set the permissions so that
- the user can read, write, execute
- the group can read, write
- the others can read
All we have to do is run
chmod u=rwx,g=rw,o=r file.sh
Or perhaps we want to make it executable to everyone, so we run
chmod +x file.sh
and if want the opposite of the above command we can do
chmod -x file.sh
2) By using octal numbers
The other way is by using octal numbers that each one of them represent the permissions for the user, group, and others, in that order.
- 4 stands for "read"
- 2 stands for "write"
- 1 stands for "execute"
- 0 stands for "no permissions."
By adding those numbers we can easily set the individual permissions. So if we take the previous example that would mean
chmod 764 file.sh
7 is the result of permissions 4+2+1, 6 is 4+2+0 and 4 is 4+0+0
You can view more information by running
Back to your problem. Although your question is unclear I would say you should use
chmod 711 hello
Which means you (the owner) have full permissions, your group can only execute and same goes for everyone else.
or (depending on how you interpret the words "all users")
chmod 771 hello
Which means you (the owner) have full permissions, same goes for your group but everyone else can only execute.
Now I should mention that you could use something like
chmod 001 hello
chmod 111 hello
but I see no point on doing something like this, unless it's a compiled program or something. But still...