Junior — Middle
How can you set or change file permissions in Linux?
sobes.tech AI
Answer from AI
In Linux, file permissions are set and modified using the chmod command.
Permissions are divided into three categories: owner (user), group (group), and others (others). For each category, you can set read (r), write (w), and execute (x) permissions.
Example usage:
- Setting read, write, and execute permissions for the owner, and only read permissions for the group and others:
chmod 744 filename
- Adding execute permission for all:
chmod +x filename
- Removing write permission for the group:
chmod g-w filename
You can also use symbolic or numeric modes to set permissions. To view current permissions, use the command ls -l filename.