Use chown
to change ownership and chmod
to change rights.
As Paweł Karpiński said, use the -R option to apply the rights for all files inside of a directory too.
Note that both these commands just work for directories too. The -R option makes them also change the permissions for all files and directories inside of the directory.
For example
sudo chown -R username:group directory
will change ownership (both user and group) of all files and directories inside of directory
and directory
itself.
sudo chown username:group directory
will only change the permission of the folder directory
but will leave the files and folders inside the directory alone.
As enzotib mentioned, you need to use sudo
to change the ownership from root to yourself.
Edit:
Note that if you use chown <user>: <file>
(Note the left-out group), it will use the default group for that user.
If you want to change only the group, you can use:
chown :<group> <file>
gksu nautilus
perhaps. I'm not quite sure and would like to know.... ;) – 8128 Oct 13 '10 at 19:39