Test 2 Flashcards

1
Q

Explain what a file descriptor does in Linux?

A

File descriptors are data channels, they read input for the keyboard standard input(channel 0), send normal output to the terminal standard output(channel 1), and sends error messages to the terminal standard error (channel 2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Stdin

A

standard input, from a keyboard

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Stdout

A

standard output whatever processes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Redirection

A

output and error cant be captured as file contents, sent to a device, or discarded

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Pipeline

A

a sequence of one or more commands separated by |

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Stderr

A

standard error where all the errors go

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Pipe

A

connects the standard output of the first command to the standard input of the next command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

tee

A

pipe and redirect at the same time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

> file

A

redirect stdout to overwrite a file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

> > file

A

redirect stdout to append a file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

> file 2> file2

A

redirect stdout to overwrite file2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

2> /dev/null

A

discard stderr error messages by redirecting to /dev/null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

&> file

A

redirect stdout and stderr to overwrite the same file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

&» file

A

redirect stdout and stderr to append to the same file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is vim?

A

Improved version of the vi editor, vim is highly configurable and efficient for practiced users

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Define the three modes of vim?

A

Edit, command, visual edit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the default mode in vim?

A

Command mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the keystroke to enter insert mode?

A

i

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the keystroke to go from insert mode to command mode?

A

esc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is the keystroke to enter visual mode for a block of text?

A

v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is the keystroke to save your files and exit vim?

A

wq

21
Q

Define and compare what a shell variable is versus an environment variable

A

Shell variables run commands or to modify behavior of the shell. Environment variables automatically copy to programs run from that shell when they start.

22
Q

How do you expand a bash shell variable?

A

Use the following syntax variableName=value

23
Q

Define these files, directories, variables, and commands?

A

a. PS1 changes the appearance of your shell prompt
b. EDITOR displays what editor is used
c. HOME users home directory
d. LANG default language, dates, currency, and character set
e. PATH contains a list of colon-separated directories that contain programs
f. env list all the environment variables for a particular shell
g. set changes something in a file
h. export changes the default in the shell
i. unset unsets something that was already set
j. unexport changes the shell back to default
k. .bashrc changes your user account that affects all interactive shell prompts at startup
l. /etc/profile.d changes the profile of the d user

24
Q

In your own words paraphrase Chapter 6 where it asks “What is a user?

A

Someone who uses a system and is assigned an ID that they can use to access the system. Different users have different levels of security.

25
Q

Explain how to use the following commands from Chapter 6:

A

a. groupadd creates groups, uses next available GID if none specified
b. id Shows information about the currently logged-in user or another user
c. passwd sets the initial password or changes existing password of username
d. ps au Views all processes in a terminal along with the user associated with that process
e. su allows a user to switch accounts
f. sudo Permits a user to run a command as root
g. usermod -g changes primary group, -aG changes supplementary group

26
Q

There are seven fields in the /etc/passwd file for each record. Define them in the proper order:

A

a. Field 1 = Username for this user
b. Field 2 = The user’s password
c. Field 3 = UID number for this user account
d. Field 4 = GID number for the user’s primary group
e. Field 5 = The real name for this user
f. Field 6 = Home directory for this user (initial working directory when the shell starts)
g. Field 7 = Default shell program for the i

26
Q

Explain the difference between primary groups and secondary groups

A

Every user has one primary group. This is the group that owns new files created by the user, Secondary group determined by /etc/group file. Also determines file access.

26
Q

What is a Red Hat User Private Group?

A

A new user is the only member of the User Private Group

26
Q

Define the four fields found in each record of the /etc/group file

A

a. Field 1 = Group name
b. Field 2 = group password field, ALWAYS x
c. Field 3 = GID number
d. Field 4 = users who are members of this group

26
Q

There are nine fields in the /etc/shadow file for each record Define them in the proper order:

A

a. Field 1 = Username
b. Field 2 = encrypted password
c. Field 3 = Day that password was last changed
d. Field 4 = minimum number of days that have to elapse since the last password change before the user can change it again.
e. Field 5 = Minimum number of days that can pass without password change before the password expires
f. Field 6 = Warning period. The user will be warned about an expiring password when they login this number of days before the deadline
g. Field 7 = Inactivity period. Once password expires it will be accepted for this many days
h. Field 8 = day on which the password expires

27
Q

What does the hyphen do in the su - command?

A

Sets up the shell environment as it were a new login as that user

27
Q

What is found in the /etc/sudoers file? How does it work?

A

The ability to configure the sudo command. The %wheel specifies group wheel, ALL=(ALL) specifies any host that has this file can run any command, final ALL specifies that wheel can run those commands as any user on the system

28
Q

Explain the differences between the root user and all other users on a Linux server

A

Root user can do everything, users can do nothing

29
Q

What is significant about UID numbers above 1000

A

Range available for regular users

29
Q

There are three pieces of information stored in a modern password hash. What are they?

A
  1. Hashing algorithm user for this password. 6 indicated SHA-512 (default). 1 is MD5, 5 SHA-256
  2. Salt used to encrypt the password
  3. Encrypted hash of the user’s password
30
Q

What is /sbin/nologin?

A

If the user attempts to log in to the system directly, the nologin shell closes the connection.

31
Q

Explain what the following options do when used on the useradd command

A

a. -a append, used with -G to add supplementary group to a user
b. -G comma-separated list of supplementary groups for the user account
c. -g gives primary group for user account
d. -L locks the user account
e. -s specifies login shell for the user account
f. -U unlocks the user account

32
Q

Explain what the following options do when used on the chage command:

A

a. -d forces user to update its password on next login
b. -E changes the user’s account to expire
c. -I Inactivty perioduser
d. -m minimum age
e. -M maximum age

33
Q

What is /sbin/nologin?

A

If the user attempts to log in to the system directly, the nologin shell closes the connection.

34
Q

Define and explain the three permissions used in Linux to control access to files (excluding directories

A

User, the one who created the file. Group, usually the primary group of the user who created the file(can be changed). Other users on the system that are not the user of the member of the owning group

35
Q

Define and explain the three permissions used in Linux to control access to directories.

A

Read, file contents can be read, contents of the directory can be listed. Write, file contents can be changed, any file can be created or deleted. Execute, files can be executed as commands, directory can become current working directory.

36
Q

What does this mean?
-rw-rw-r-

A

The user who made the file can read and write it, people apart of the groups can read and write it, people who arent in the group can only read the file

37
Q

What is the command to add write permissions to all group owners below /var/www/html/ist190/ on a Linux webserver, including directories and files?

A

Chmod g+w ist190

38
Q

What is the command using octal notation to changer the permissions on /var/www/html/ist190/index.html so that the user owner has RWX, the group has RX, and the world has R

A

chmod 754 index.htm

39
Q

What is the most efficient and fastest way to change the user owner to ist190student and the group owner to wheel for all files and directories under /var/www/html/ist190/ on a Linux webserver

A

Chown student:wheel ist190

40
Q

You have been asked to setup a collaborative directory for all members of the music group at /data/musicgroup/ on your fileserver. What is the command to set create these special permissions (sgid)?

A

Chmod g+s directory musicgroup

41
Q

What is the purpose of the sticky bit? How do you set it

A

Sets a special restriction on the deletion of files. (only the user and root can delete)

42
Q

What is an umask and how does it work? Show examples of how changing the umask affects files and directories

A

Used to clear permissions from a certain category of users. By setting umask to 0, permissions are changed from read, to read and write. Setting umask to 007 will mask all file and directory permissions.

43
Q

What file has to be modified to change the default umask for ALL users who log in to your Linux server? Give an example

A

The startup shell script must be modified to change the default u mask. Root must add a shell startup script named /etc/profile.d/localumask.sh