Sobes.tech
Junior — Middle

How to grant or change user permissions in the Linux operating system?

sobes.tech AI

Answer from AI

In Linux, user permissions are managed using the commands chmod, chown, and usermod.

  • chmod changes the access rights to files and directories (read, write, execute) for the owner, group, and others. Example: chmod 755 file — the owner can read, write, and execute; others can read and execute.

  • chown changes the owner and group of a file or directory. Example: chown user:group file — sets the owner and group.

  • usermod modifies user parameters, including their groups. Example: usermod -aG group user — adds the user to an additional group.

You can also use groups to view user groups and id for detailed information.

For more fine-grained permission control, ACLs (Access Control Lists) are used with the commands setfacl and getfacl.