Lesson 5 Flashcards
How are users and groups indentified?
UIDs and GIDs
What is the length of modern UIDs?
64 bits
Every user has a UID and a GID
True
What is the UID of root?
0
What unique characteristics do user account shave?
UID starting with 1000
A defined home directory
A defined login shell
Name attributes of system accounts?
UID under 100 or 500-999
No home directory
No shell defined
What is the primary difference between system and service accounts?
Not a huge difference but their UID/GID/s will be different, service account >1000
What is the command to change the shell?
chsh
What does the id command do?
Lists basic information about the current shell user
what do the “who” and “w” commands do?
they list active logins to the system
What’s the biggest issue with using su to switch to root?
If a regular user’s session is compromised, the root password could be captured
Name the main configuration file locations for user accounts and access controls
/etc/passwd
/etc/group
/etc/shadow (passwords)
/etc/gshadow
what does the /etc/sudoers file contain?
users who can use the sudo command
What is the /etc/passwd file?
commonly referred to as the “password file”. each line contains multiple fields always delimited by a colon
What is the GECOS field?
contains three or more fields delimited by a comma, normally NAME, LOCATION,CONTACT
What does the chfn command do?
Changes information int he GECOS field
what does /etc/group store?
colon delimited information about groups
NAME:PASSWORD:GID:MEMBERS
In which files are UID and GID stored?
/etc/passwd
In which file are Groups stored?
/etc/group
In which file are passwords stored?
/etc/shadow
How are passwords stored?
With a one way hash
Which command to get all active logins on the system?
W command
command to add a user?
useradd username
command to set a users password?
passwd username
which command to list a users information?
id username
lists the groups that a user is part of
groups username
how do delete a user?
userdel -r username
what is the /etc/skel directory?
contains the skeleton structure files and directories to create for a users home directory when created
how to add a new group
groupadd groupname
how to delete a group
groupdel groupname
how to lock a user account?
passwd -l username
which file does this entry belong to?
developer:x:1010:frank,grace,dave
/etc/group
which file does this entry belong to?
root:x:0:0:root:/root:/bin/bash
/etc/passwd
which file does this entry belong to?
henry:$1$.AbCdEfGh123456789A1b2C3d4.:18015:20:90:5:30::
/etc/shadow
which file does this entry belong to?
henry:x:1000:1000:User Henry:/home/henry:/bin/bash
/etc/passwd
which file does this entry belong to?
staff:!:dave:carol,emma
/etc/gshadow
web_developer:!:kevin:grace,kevin,christian
who is the administrator of this group?
Kevin
Where you can you see a users password expiration?
in /etc/shadow in the third group
Where can you see when a users password expires?
Second to last field in /etc/shadow
Using symbolic mode, what are the symbols to add, remove or set a specific value?
+, -, =
If you want to grant write permission to a file for members of a group what would the command be (symbolic mode)
chmod g+w file.type
If you want to remove read permissions of a user from a file in symbolic mode?
chmod u-r filename
In symbolic mode, set rw permissions for all on a file
chmod a=rw- filename
In symbolic mode how can you edit permissions for file and group at the same time?
chmod u+rwx,g-x filename
how can you modify permissions recursively?
chomd -R u+rwx directoryname/
In numeric mode how could use set user and group to read write?
chomd 660 file
In numeric mode describe the octet values
Read = 4
Write = 2
Execute = 1
So r/w would be 6 for each group
When is symbolic mode better than numeric mode?
When you want to just change one specific permission without having to correctly write the others ex:
chmod u+x filename
what is chown?
Used to modify the ownership of a file or directory
What is the chown syntax?
chown username:groupname filename
Use chown to change ownership of a file to jane
chown jane filename
how to query groups on your system with a command
groups
command to show members of a group
groupmems
What does the sticky bit do?
Applies only to directories and prevents users from removing or renaming a file in a directory unless they own that file or directory
what does chgrp do?
changes the owning group of a file
what does ls -ld do?
Lists the attributes of a directory instead of listing its contents
What is the GID flag
Sets Group ID Bit, octal value of 2. Can be applied to executable files or directories. On an executable it will make the process executing it inherit the privileges of the group who owns the file
what kind of file is this?
brw-rw—- 1 root disk 8, 17 Dec 21 18:51 /dev/sdb1
a block device as annotated by the “b”
What are temporary files?
Files used by programs to store data that is only needed for a short period of time
Where are temp files normally stored?
/tmp
/var/temp
/run
What does the sticky bit do?
it prevents users from removing or renaming a
file within that directory unless they own the file
What problem does the sticky bit solve?
For global areas like /tmp, it allows the prevention of users from deleting files that they do not own
what does SUID do?
Applies to executables and enables the file to run with the permissions of the owner and not the person executing it
What does SGID do?
Allows a file to be executed with the privileges of the group and not the user executing it
what command would you use to create a hard link named hardlink in the directory /home/carol/Documents/ to a file named target.txt in the current directory?
ln target.txt /home/carol/Documents/hardlink
how do you create a symbolic link named softlink in /home/carol/Documents/ pointing to a file target.txt in the current directory?
ln -s target.txt /home/carol/Documents/softlink
what’s the difference between a hard link and a symbolic (soft) link?
a hard link is another name for the same file (points to the same inode), while a symbolic link is a pointer to the path of the original file.
what is the chmod symbolic mode parameter to enable the sticky bit on a directory?
chmod +t <directory></directory>
if you create a symbolic link without specifying the full path to the target, what might happen if you move the link?
the link might break because the system interprets the target’s location as relative to the link’s location.
which temporary directory must be cleared during the boot process?
/tmp
explain the difference between a hard link to a file and a copy of this file.
a hard link points to the same inode as the original file, so changes to one affect the other. a copy is a separate file with its own inode, so changes to one do not affect the other.
what is an inode?
a data structure that stores attributes about the file including it’s memory location etc