MODULE 17- Owners and permissions Flashcards
Which user is the owner of a file by default when it’s created?
The user who created the file
Which group becomes the group owner of a file by default when a user creates it?
The user’s primary group
Which command should be used to check which groups you can switch to using newgrp?
groups
What determines the ownership of a file internally in the operating system?
→ UID for user ownership and GID for group ownership
Which command is used to verify the current user and their group memberships, including UID and GID?
id
Which situation is indicated when a user and their primary group share the same name and numeric ID?
→ The user is in a User Private Group (UPG)
Which command is used to create an empty file that will automatically be owned by the current user and group?
touch
Which part of this command output represents the user and group owner: -rw-rw-r–. 1 sysadmin sysadmin 0 Oct 21 10:18?
→ The first ‘sysadmin’ is the user owner, the second ‘sysadmin’ is the group owner
Which command reveals all files, including hidden ones, along with their ownership and permissions?
→ ls -la
Which command is used by a user to change their current primary group during a session?
→ newgrp group_name
What must be true for a user to successfully switch to another group using newgrp?
→ The user must already be a member of that group
Which command shows the current primary group and all group memberships with UID/GID details?
id
After using newgrp research, which group will new files belong to by default?
→ The research group
How can a user return to their original primary group after using newgrp?
→ By running the exit command to leave the subshell
Which command is used by administrators to permanently change a user’s primary group?
→ usermod -g groupname username
Which command is used to change the group owner of a file?
→ chgrp group_name file
What is required for a non-root user to successfully change a file’s group using chgrp?
→ The user must own the file and the target group must be one they are a member of
What does this command do: chgrp research sample?
→ Changes the group ownership of the file sample to the research group
Which option allows chgrp to change the group of all files and subdirectories in a directory?
→ -R (recursive)
What does the command chgrp -R development test_dir do?
→ Changes the group owner of test_dir and everything inside it to development
Which command displays a file’s ownership, permissions, and other detailed metadata?
stat
Which command is used to change the user owner of a file or directory?
chown
Can a regular user change the user ownership of their own file to another user?
→ No, only root can do this
What does the command chown jane /tmp/filetest1 do?
→ Changes the user owner of /tmp/filetest1 to jane, keeping the group unchanged