`
If you find these tutorials useful, Please consider making a donation.

TheFrugalComputerLinuxLogo.png
TheFrugalComputerGuy.png
Linux Command Line 8
Permissions, Ownership, and Groups







Linux Command Line (21) File and Directory Permissions

I start off calling the file owner the user/owner and we look at the group and discuss that each user/owner and group have a number associated with them. The number is what Linux uses, the name is just there to help us humans keep track of the user/owner and group IDs.

We then look at the first column displayed with the ls -lh command and see that the first character is describes what type of file it is "d" for directory or "-" for file

The nex three characters are for the user/owner permissions. followed by the group permissions, then followed by the permissions for anyone that is not user/owner of the file, and is not a member of the group of this file (but still have access to this file).

The "r" is for read privileges, the "w" is for write, and the "x" is for execute privileges. A dash in place of one of those letters shows there are no privilege for that letter.

A user/owner of a file can change the permissions of that file with the chmod (change mode) command.

The chmod command assigns privileges as ugo ("u" for User/owner, "g" for Group, and "o" for Other)

We can also see how to use the chmod command to assign privileges with octal permissions (numbers 0-7)





 






Linux Command Line (22) File Ownership

Standard Linux users cannot change the owner of a file, but they can change the group if they are the file owner, but only to a group that they are a member.

Only a privileged user can update the owner of a file.

To find out what groups and ID is a member of type the command groups followed by the ID of the userID you want to see what groups that ID is a member

The owner and group can be changed with the chown (for change owner) command

The chown command can be used to only update the group or you can use the chgrp command to change the group

chgrp can be used to change the group





 






Linux Command Line (23) Groups pt1

I have added 6 more non-privileged users to the system. Then we add 2 new groups with the groupadd command.

We look to see if a group exits with the gentent group command..

We then delete one of the groups we added with the groupdel command

We change a group name with the groupmod command

We see the group information is stored in /etc/group file and /etc/gshadow file

We then set the some of the new users added as group administrators and group members using the gpasswd file





 






Linux Command Line (24) Groups pt2

We pick up from where we left off in the last video showing that an administrative group user can add group members (with needing to be an privileged user) with the passwd command.

Administrative users will need to use the getent group command to see the group members in a group.

Administrative users can delete members from the group with the gpasswd command.

Administrative users can set and update the group password.

The Administrative user can share the group password to allow a person not in the group to have temporary access to that group.

The newgrp command will update a gid to be a specific group ID allowing users to create files with that gid (group ID).

Only a privileged user can permanently update a gid (group ID)