Howto change permissions, ownership or group of File/Directory
This is quick
and simple guide for changing the permissions, ownership or group of
File/Directory
Let's start with the permissions: For that we are going to use the
command chmod. The
usage is easy :
chmod "options"
"path/to/file/or/dir"
Here are
the most common "options". The options variable can be either numberic
either letters.
chmod a-w
"example/file/dir"
This will remove the permissions to write
and execute by user, group, and everyone else.
chmod 777
"example/file/dir"
This will
change the permissions to write and execute by user, group, and
everyone else.
chmod a+w
"example/file/dir"
This will actualy do the same as 777.
For more informatio check the chmod manual pages.
REMEMBER: You need to
be the owner of the file or Super User a.k.a root
The second thing that we will learn is to change is the ownership:For
that we are going to use the command chown. The usage is really easy,
but you need to be Super User a.k.a root, so either log in as root with
"su", either use sudo:
sudo chown "user"
"example/file/dir"
This command will change the ownership of "example/file/dir" to user
"user"
For more information check the chown manual pages.
And now let's learn how to change to group:We are going to use the
command chgrp
chgrp "example/group"
"example/file/dir"
This will change the goup of the file "example/file/dir" to
the group "example/group".
REMEMBER: You need to
be the owner of the file and a member of the group you want to change
or Super User a.k.a root.
de.li.cio.us