Advanced techniques: working with permissions and ownership
Linux file permissions control who can read, write, and execute files.
Understanding permissions
Use ls -l
to see file permissions. They look like -rwxr-xr-x
. The first character indicates the file type (-
for a regular file, and d
for a directory), and the following nine characters represent the permissions: read (r
), write (w
), and execute (x
) for the owner, group, and others.
Changing permissions
Use the chmod
command to change permissions. For example, chmod u=rwx,g=rx,o=rx filename
sets read, write, and execute permissions for the owner, and read and execute permissions for the group and others.
Ownership
Use chown user:group filename
to change the owner and group of a file.
Elevated permissions
Sometimes, you will need to temporarily elevate your privileges to run specific commands as an administrator. Ubuntu assumes that tasks that require administrative permissions are run with the...