Saltar al contenido

Operating systems How to change or easily change permissions and owners in Linux

Operating systems How to change or easily change permissions and owners in Linux

Users who change their computer to Linux, count on what is known as free software, which allows slightly more complex operations. Because it has various information commands that can be modified at the user’s request.

However, this does not mean that have basic functions such as access to video platforms such as Netflix, Disney + or Amazon Prime, and you can activate a Microsoft Office 365 license or download an antivirus such as Avast Free.

What should I consider before changing my Linux permissions?

It is important to think and consider that you have a open source software like Linux, It grants you certain privileges that can be modified from the superuser interface. They can be turned on or off at any time you want.

In other words, it is possible to grant and withdraw capabilities on your computer with a few simple steps by your device administrator or root.

How do I change the permissions and owners of my Linux computer?

The first thing is to enter the command line and type the following: ls -l (Lowercase L). A bar will appear later where you can see text similar to the following: -rwxrwxr-x 1 user user 0 19 Jan 12:59 document1.txt from which you can identify the following meaning by number:

  • : Archive.
  • d: Director.
  • it: Links file, soft / symbolic link.
  • p: Special channel file, pipe.
  • c: Special characters, tty device, printer, etc.
  • b: Special blocks, special device files.

Later the next section of letters that are observed, are hierarchically ordered and are practically divided into three groups:

  1. Owner.
  2. Owners group.
  3. Users who do not belong none of the above.

They have inside a series of letters that define the type of access or permission that it is authorized to perform:

  • R, read permission, which means that only viewing it is allowed.
  • W, write permission, as the name implies, the user is authorized to edit the contents of the selected file.
  • X, the execution permission, ie, being the highest rank, the execution of the program is allowed if necessary.
  • , access restricted, virtually none of the above actions can be performed.

If we take the previous example as a basis (-rwxrwxr-x 1 user user 0 19 Jan 12:59 document1.txt) would suspect that the owner of the (-) file has full access to the file we are selecting rwx. And, in addition, we can see that the rest of the team can only view and run it.

computer used

Knowing how to read the permissions of each file, we can continue to make changes with the command CHMOD, and DISPLAYED to change ownership.

To change permissions:

To use the command CHMODYou should know that two forms of editing are used, symbolic and numerical. For symbolic it is important to remember the previous meanings and also these:

  • OR, Access the user.
  • G, Group.
  • OR, For those who do not belong to either
  • TO, All users
  • +, Add a license.
  • -, Remove permissions
  • =, Works to assign a new one.

Example of how I wrote the command, if I just wanted the owner to be able to read the file, I would put: chmod u = r, g =, o =. And if we want the owner to be able to read and write and for the rest only viewing is allowed, then we should put: chmod u = rw, g = r, o = r.

And for the numerical form, we have the meanings by the number:

  • 0: – – without access
  • one: – x runs
  • Two: -w- write
  • 3: -wx writes and executes
  • 4: r – read only
  • 5: rx read and executed
  • 6: rw- reads and writes
  • 7: rw- = read, write and execute.

How to edit the owner so that if we want the file to be read only by the owner, we write: chmod 400 Or if we want the owner to be able to edit and read, but the rest only reads, we would put: chmod 644

To change owners:

Based on the fact that we want to change the sample text and the IPAP user, you should enter chown IPAP example.txt and then identify what you want to change.