Ubuntu – How do file permissions work

chmodcommand linepermissions

Can you explain briefly the main concepts and command line tools used to manage file permissions?

Best Answer

  • Each file has rights for three different categories:

    • the owner of the file,
    • the group associated with the file, and
    • everybody else.

    Rights mean the right to read the file, the right to write to the file, or the right to execute the file in case of a script or program.

    On the CLI, you may

    • change the owner with chown, e.g. chown guillermooo
    • change the group with chgrp, e.g. chgrp root
    • change the rights with chmod, e.g. chmod u+w filename.ext (Adds writing permission for the owner of the file filename.ext)

    If you'd like to know more about each of these tools, open a terminal and type man [tool], e.g. man chmod.