Day 1/90 Days-of-DevOps challenge

If you are new to Linux, one of the key concepts to understand is permissions. Permissions define who can access, modify, and execute files and directories on a Linux system. There are three types of permissions: owner, group, and others. In this blog post, we will focus on commands for user groups and others.

1.]Viewing Permissions: To view permissions for a file or directory, use the ls -l command. This will show you the permissions in the following format:

command- -rwxr-xr-- 1 user group 4096 Mar 25 11:18 file.txt In this command , the permissions are rwxr-xr--. The first three letters (rwx) refer to the owner's permissions, the second three letters (r-x) refer to the group's permissions, and the last three letters (r--) refer to the permissions for others.

2.]Changing Permissions: To change permissions for a file or directory, use the chmod command. For example, to give the group read and write permissions on a file, use the following command:

command-chmod g+rw file.txt

In this example, the permissions are rwxr-xr--. The first three letters (rwx) refer to the owner's permissions, the second three letters (r-x) refer to the group's permissions, and the last three letters (r--) refer to the permissions for others.

3.]Changing Permissions: To change permissions for a file or directory, use the chmod command. For example, to give the group read and write permissions on a file, use the following command: bash

command-chmod g+rw file.txt

here, The g+rw means add read and write permissions for the group. You can also use u for owner and o for others, followed by + or - to add or remove permissions, and r, w, or x for read, write, or execute permissions.

4.Changing Ownership: To change the owner or group of a file or directory, use the chown or chgrp command, respectively. For example, to change the owner of a file to user1 and the group to group1, use the following command:

command-chown user1 file.txt chgrp group1 file.txt

5.Setting Default Permissions: To set default permissions for new files and directories, you can use the umask command. This command sets the default permission mask that is applied to newly created files and directories. For example, to set the default permission to rwxr-xr-x, use the following command:

command-umask 022

This means that the owner has read, write, and execute permissions, and the group and others have read and execute permissions.